shared/optparser.c: remove surrounding whitespace in non-quoted strings (bb#1518)

git-svn: trunk@5007
remotes/push_mirror/0.95
Tomasz Kojm 16 years ago
parent 655bc62709
commit cebb446ddb
  1. 5
      ChangeLog
  2. 13
      shared/optparser.c

@ -1,3 +1,8 @@
Thu Apr 2 14:02:33 CEST 2009 (tk)
----------------------------------
* shared/optparser.c: remove surrounding whitespace in non-quoted strings
(bb#1518)
Thu Apr 2 12:45:52 CEST 2009 (tk)
----------------------------------
* clamscan/manager.c: check rlim_cur instead of rlim_max

@ -719,7 +719,7 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo
break;
}
if(!(pt = strchr(buff, ' '))) {
if(!(pt = strpbrk(buff, " \t"))) {
if(verbose)
fprintf(stderr, "ERROR: Missing argument for option at line %d\n", line);
err = 1;
@ -727,7 +727,7 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo
}
name = buff;
*pt++ = 0;
for(i = 0; i < (int) strlen(pt) - 1 && pt[i] == ' '; i++);
for(i = 0; i < (int) strlen(pt) - 1 && (pt[i] == ' ' || pt[i] == '\t'); i++);
pt += i;
if((i = strlen(pt)) && pt[i - 1] == '\n')
pt[i-- - 1] = 0;
@ -754,6 +754,15 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo
err = 1;
break;
}
} else {
for(i = strlen(pt); i >= 1 && (pt[i - 1] == ' ' || pt[i - 1] == '\t'); i--);
if(!i) {
if(verbose)
fprintf(stderr, "ERROR: Missing argument for option at line %u\n", line);
err = 1;
break;
}
pt[i] = 0;
}
} else {

Loading…
Cancel
Save