/[imapfilter]/imapfilter/file.c
ViewVC logotype

Diff of /imapfilter/file.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by lefcha, Mon Aug 26 20:34:25 2002 UTC revision 1.46 by lefcha, Mon Feb 3 20:22:01 2003 UTC
# Line 17  Line 17 
17    
18  extern char logfile[PATH_MAX];  extern char logfile[PATH_MAX];
19  extern unsigned int options;  extern unsigned int options;
20    extern char charset[CHARSET_LEN];
21  extern unsigned int flags;  extern unsigned int flags;
22  extern unsigned int interval;  extern unsigned int interval;
23  extern long timeout;  extern long timeout;
# Line 63  int read_config(char *cfg) Line 64  int read_config(char *cfg)
64      fclose(fd);      fclose(fd);
65    
66  #ifdef DEBUG  #ifdef DEBUG
67      printf("debug: options: %0#10x\n", options);      printf("debug: options: %0#10x '%s'\n", options, charset);
68  #endif  #endif
69    
70      return 0;      return 0;
# Line 128  int parse_config(FILE * fd) Line 129  int parse_config(FILE * fd)
129          "^[[:blank:]]*JOB[[:blank:]]+([[:alnum:],_-]+)[[:blank:]]+"          "^[[:blank:]]*JOB[[:blank:]]+([[:alnum:],_-]+)[[:blank:]]+"
130          "([[:alnum:],_-]+)[[:blank:]]*\n$",          "([[:alnum:],_-]+)[[:blank:]]*\n$",
131    
132          "^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(LOGFILE)"          "^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(LOGFILE|CHARSET)"
133          "[[:blank:]]*=[[:blank:]]*([[:print:]]+)\n$",          "[[:blank:]]*=[[:blank:]]*(\"[[:print:]]*\"|[[:graph:]]+)"
134            "[[:blank:]]*\n$",
135    
136          "^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(ERRORS|EXPUNGE|HEADERS|"          "^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(ERRORS|EXPUNGE|HEADERS|"
137          "NAMESPACE|SUBSCRIBE|WARNING)[[:blank:]]*=[[:blank:]]*(YES|NO)"          "NAMESPACE|SUBSCRIBE|WARNING)[[:blank:]]*=[[:blank:]]*(YES|NO)"
# Line 200  int parse_config(FILE * fd) Line 202  int parse_config(FILE * fd)
202  void set_options(char *line, regmatch_t * match)  void set_options(char *line, regmatch_t * match)
203  {  {
204      if (!strncasecmp(line + match[2].rm_so, "logfile", 7)) {      if (!strncasecmp(line + match[2].rm_so, "logfile", 7)) {
205          if (!*logfile)          if (!*logfile) {
206              strncat(logfile, line + match[3].rm_so,              if (*(line + match[3].rm_so) == '"' &&
207                      min((match[3].rm_eo - match[3].rm_so), PATH_MAX - 1));                  *(line + match[3].rm_eo - 1) == '"')
208                    strncat(logfile, line + match[3].rm_so + 1,
209                            min((match[3].rm_eo - match[3].rm_so - 2),
210                                PATH_MAX - 1));
211                else
212                    strncat(logfile, line + match[3].rm_so,
213                            min((match[3].rm_eo - match[3].rm_so),
214                                PATH_MAX - 1));
215            }
216        } else if (!strncasecmp(line + match[2].rm_so, "charset", 7)) {
217            if (*(line + match[3].rm_so) == '"' &&
218                *(line + match[3].rm_eo - 1) == '"')
219                strncat(charset, line + match[3].rm_so + 1,
220                        min((match[3].rm_eo - match[3].rm_so - 2),
221                            CHARSET_LEN - 1));
222            else
223                strncat(charset, line + match[3].rm_so,
224                        min((match[3].rm_eo - match[3].rm_so), CHARSET_LEN - 1));
225      } else if (!strncasecmp(line + match[2].rm_so, "errors", 6)) {      } else if (!strncasecmp(line + match[2].rm_so, "errors", 6)) {
226          if (!strncasecmp(line + match[3].rm_so, "yes", 3))          if (!strncasecmp(line + match[3].rm_so, "yes", 3))
227              options |= OPTION_ERRORS;              options |= OPTION_ERRORS;

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26