関数 | |
BOOL | sysv_cache_reload (void) |
void | print_svid_dummy (void) |
BOOL sysv_cache_reload | ( | void | ) |
print_svid.c の 38 行で定義されています。
参照先 buf・file_lines_free()・file_lines_pload()・name・pcap_cache_add()・strchr_m().
参照元 pcap_cache_reload().
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 * if "lpstat -v" is NULL then we check if schedular is running if it is 00055 * that means no printers are added on the HP-UX system, if schedular is not 00056 * running we display reload error. 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 /* eat "system/device for " */ 00082 if (((tmp = strchr_m(buf, ' ')) == NULL) || 00083 ((tmp = strchr_m(++tmp, ' ')) == NULL)) 00084 continue; 00085 00086 /* 00087 * In case we're only at the "for ". 00088 */ 00089 00090 if(!strncmp("for ", ++tmp, 4)) { 00091 tmp=strchr_m(tmp, ' '); 00092 tmp++; 00093 } 00094 00095 /* Eat whitespace. */ 00096 00097 while(*tmp == ' ') 00098 ++tmp; 00099 00100 /* 00101 * On HPUX there is an extra line that can be ignored. 00102 * d.thibadeau 2001/08/09 00103 */ 00104 if(!strncmp("remote to", tmp, 9)) 00105 continue; 00106 00107 name = tmp; 00108 00109 /* truncate the ": ..." */ 00110 if ((tmp = strchr_m(name, ':')) != NULL) 00111 *tmp = '\0'; 00112 00113 /* add it to the cache */ 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 }
void print_svid_dummy | ( | void | ) |