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

Diff of /imapfilter/data.c

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

revision 1.30 by lefcha, Thu Jul 25 21:27:48 2002 UTC revision 1.31 by lefcha, Mon Aug 26 20:34:25 2002 UTC
# Line 221  void process_mboxgrp(mboxgrp_t * node, c Line 221  void process_mboxgrp(mboxgrp_t * node, c
221      unsigned int i = 0;      unsigned int i = 0;
222      char *tok;      char *tok;
223    
224      while (i < MBOXGRP_MBOXES_MAX - 1 && (tok = strsep(&mboxs, ","))) {      tok = strtok_r(mboxs, ",", &mboxs);
225        while (i < MBOXGRP_MBOXES_MAX - 1 && tok) {
226          node->mboxes[i] = (mbox_t *) set_mbox(tok);          node->mboxes[i] = (mbox_t *) set_mbox(tok);
227          node->mboxes[++i] = NULL;          node->mboxes[++i] = NULL;
228    
229            tok = strtok_r(NULL, ",", &mboxs);
230      }      }
231  }  }
232    
# Line 434  int set_action(char *line, regmatch_t * Line 437  int set_action(char *line, regmatch_t *
437    
438          c = cp = (char *)malloc(match[9].rm_eo - match[9].rm_so + 1);          c = cp = (char *)malloc(match[9].rm_eo - match[9].rm_so + 1);
439          xstrncpy(c, line + match[9].rm_so, match[9].rm_eo - match[9].rm_so);          xstrncpy(c, line + match[9].rm_so, match[9].rm_eo - match[9].rm_so);
440          while ((t = strsep(&c, ","))) {  
441            t = strtok_r(c, ",", &c);
442            while (t) {
443              if (!strcasecmp(t, "none")) {              if (!strcasecmp(t, "none")) {
444                  if (match[9].rm_eo - match[9].rm_so != strlen("none"))                  if (match[9].rm_eo - match[9].rm_so != strlen("none"))
445                      return ERROR_CONFIG_PARSE;                      return ERROR_CONFIG_PARSE;
# Line 450  int set_action(char *line, regmatch_t * Line 455  int set_action(char *line, regmatch_t *
455                  cur_fltr->action.msgflags |= MESSAGE_FLAG_DRAFT;                  cur_fltr->action.msgflags |= MESSAGE_FLAG_DRAFT;
456              else              else
457                  return ERROR_CONFIG_PARSE;                  return ERROR_CONFIG_PARSE;
458    
459                t = strtok_r(NULL, ",", &c);
460          }          }
461          xfree(cp);          xfree(cp);
462      } else if (!strncasecmp(line + match[1].rm_so, "list", 4)) {      } else if (!strncasecmp(line + match[1].rm_so, "list", 4)) {
# Line 680  int set_job(char *line, regmatch_t * mat Line 687  int set_job(char *line, regmatch_t * mat
687      mbgrp = (char *)xmalloc(n + 1);      mbgrp = (char *)xmalloc(n + 1);
688    
689      /* Go through filters. */      /* Go through filters. */
690      while ((ftok = strsep(&f, ","))) {      ftok = strtok_r(f, ",", &f);
691        while (ftok) {
692          cf = (filter_t *) find_filter(ftok);          cf = (filter_t *) find_filter(ftok);
693          if (!cf)          if (!cf)
694              return ERROR_CONFIG_PARSE;              return ERROR_CONFIG_PARSE;
# Line 689  int set_job(char *line, regmatch_t * mat Line 697  int set_job(char *line, regmatch_t * mat
697          g[n] = 0;          g[n] = 0;
698    
699          /* Go through mailbox groups. */          /* Go through mailbox groups. */
700          while ((gtok = strsep(&g, ","))) {          gtok = strtok_r(g, ",", &g);
701            while (gtok) {
702              cg = (mboxgrp_t *) find_mboxgrp(gtok);              cg = (mboxgrp_t *) find_mboxgrp(gtok);
703              if (!cg)              if (!cg)
704                  return ERROR_CONFIG_PARSE;                  return ERROR_CONFIG_PARSE;
705              link_mbox_filter(cf, cg);              link_mbox_filter(cf, cg);
706    
707                gtok = strtok_r(NULL, ",", &g);
708          }          }
709    
710            ftok = strtok_r(NULL, ",", &f);
711      }      }
712    
713      xfree(fltr);      xfree(fltr);
# Line 788  int string_decode(char *str) Line 801  int string_decode(char *str)
801    
802      while (*c) {      while (*c) {
803          if (*c == '%') {          if (*c == '%') {
804              if (!isxdigit(*(c + 1)) || !isxdigit(*(c + 2)))              if (!isxdigit((unsigned char)(*(c + 1))) ||
805                    !isxdigit((unsigned char)(*(c + 2))))
806                  return ERROR_CONFIG_PARSE;                  return ERROR_CONFIG_PARSE;
807    
808              xstrncpy(hex, ++c, 2);              xstrncpy(hex, ++c, 2);
809              hex[2] = 0;              hex[2] = 0;
810    
811              if (!isprint(*str = (char)strtoul(hex, NULL, 16)))              if (!isprint((unsigned char)(*str = (char)strtoul(hex, NULL, 16))))
812                  return ERROR_CONFIG_PARSE;                  return ERROR_CONFIG_PARSE;
813    
814              str++;              str++;

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26