関数 | |
BOOL | aix_cache_reload (void) |
void | print_aix_dummy (void) |
BOOL aix_cache_reload | ( | void | ) |
print_aix.c の 31 行で定義されています。
参照先 pcap_cache::comment・fgets_slash()・line・name・pcap_cache_add()・safe_free()・strchr_m()・strstr_m()・x_fclose()・x_fopen().
参照元 pcap_cache_reload().
00032 { 00033 int iEtat; 00034 XFILE *pfile; 00035 char *line = NULL, *p; 00036 pstring name, comment; 00037 00038 *name = 0; 00039 *comment = 0; 00040 00041 DEBUG(5, ("reloading aix printcap cache\n")); 00042 00043 if ((pfile = x_fopen(lp_printcapname(), O_RDONLY, 0)) == NULL) { 00044 DEBUG(0,( "Unable to open qconfig file %s for read!\n", lp_printcapname())); 00045 return False; 00046 } 00047 00048 iEtat = 0; 00049 /* scan qconfig file for searching <printername>: */ 00050 for (;(line = fgets_slash(NULL, sizeof(pstring), pfile)); safe_free(line)) { 00051 if (*line == '*' || *line == 0) 00052 continue; 00053 00054 switch (iEtat) { 00055 case 0: /* locate an entry */ 00056 if (*line == '\t' || *line == ' ') 00057 continue; 00058 00059 if ((p = strchr_m(line, ':'))) { 00060 *p = '\0'; 00061 p = strtok(line, ":"); 00062 if (strcmp(p, "bsh") != 0) { 00063 pstrcpy(name, p); 00064 iEtat = 1; 00065 continue; 00066 } 00067 } 00068 break; 00069 00070 case 1: /* scanning device stanza */ 00071 if (*line == '*' || *line == 0) 00072 continue; 00073 00074 if (*line != '\t' && *line != ' ') { 00075 /* name is found without stanza device */ 00076 /* probably a good printer ??? */ 00077 iEtat = 0; 00078 if (!pcap_cache_add(name, NULL)) { 00079 safe_free(line); 00080 x_fclose(pfile); 00081 return False; 00082 } 00083 continue; 00084 } 00085 00086 if (strstr_m(line, "backend")) { 00087 /* it's a device, not a virtual printer */ 00088 iEtat = 0; 00089 } else if (strstr_m(line, "device")) { 00090 /* it's a good virtual printer */ 00091 iEtat = 0; 00092 if (!pcap_cache_add(name, NULL)) { 00093 safe_free(line); 00094 x_fclose(pfile); 00095 return False; 00096 } 00097 continue; 00098 } 00099 break; 00100 } 00101 } 00102 00103 x_fclose(pfile); 00104 return True; 00105 }
void print_aix_dummy | ( | void | ) |