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 #include "includes.h"
00029
00030 #ifdef AIX
00031 BOOL aix_cache_reload(void)
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
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:
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:
00071 if (*line == '*' || *line == 0)
00072 continue;
00073
00074 if (*line != '\t' && *line != ' ') {
00075
00076
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
00088 iEtat = 0;
00089 } else if (strstr_m(line, "device")) {
00090
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 }
00106
00107 #else
00108
00109 void print_aix_dummy(void);
00110 void print_aix_dummy(void) {}
00111 #endif