00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "includes.h"
00036
00037 #if defined(SYSV) || defined(HPUX)
00038 BOOL sysv_cache_reload(void)
00039 {
00040 char **lines;
00041 int i;
00042
00043 #if defined(HPUX)
00044 DEBUG(5, ("reloading hpux printcap cache\n"));
00045 #else
00046 DEBUG(5, ("reloading sysv printcap cache\n"));
00047 #endif
00048
00049 if ((lines = file_lines_pload("/usr/bin/lpstat -v", NULL)) == NULL)
00050 {
00051 #if defined(HPUX)
00052
00053
00054
00055
00056
00057
00058
00059 char **scheduler;
00060 scheduler = file_lines_pload("/usr/bin/lpstat -r", NULL);
00061 if(!strcmp(*scheduler,"scheduler is running")){
00062 DEBUG(3,("No Printers found!!!\n"));
00063 file_lines_free(scheduler);
00064 return True;
00065 }
00066 else{
00067 DEBUG(3,("Scheduler is not running!!!\n"));
00068 file_lines_free(scheduler);
00069 return False;
00070 }
00071 #else
00072 DEBUG(3,("No Printers found!!!\n"));
00073 return False;
00074 #endif
00075 }
00076
00077 for (i = 0; lines[i]; i++) {
00078 char *name, *tmp;
00079 char *buf = lines[i];
00080
00081
00082 if (((tmp = strchr_m(buf, ' ')) == NULL) ||
00083 ((tmp = strchr_m(++tmp, ' ')) == NULL))
00084 continue;
00085
00086
00087
00088
00089
00090 if(!strncmp("for ", ++tmp, 4)) {
00091 tmp=strchr_m(tmp, ' ');
00092 tmp++;
00093 }
00094
00095
00096
00097 while(*tmp == ' ')
00098 ++tmp;
00099
00100
00101
00102
00103
00104 if(!strncmp("remote to", tmp, 9))
00105 continue;
00106
00107 name = tmp;
00108
00109
00110 if ((tmp = strchr_m(name, ':')) != NULL)
00111 *tmp = '\0';
00112
00113
00114 if (!pcap_cache_add(name, NULL)) {
00115 file_lines_free(lines);
00116 return False;
00117 }
00118 }
00119
00120 file_lines_free(lines);
00121 return True;
00122 }
00123
00124 #else
00125
00126 void print_svid_dummy(void);
00127 void print_svid_dummy(void) {}
00128 #endif