aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/defs.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2000-08-30 20:51:13 +0000
committerBrian Somers <brian@FreeBSD.org>2000-08-30 20:51:13 +0000
commit4c066cf9f1ad3497d4a62b2af45e84d35b89577a (patch)
tree2b0f4c8b54b230501aac60b9508f2856163c3dfd /usr.sbin/ppp/defs.c
parent106ae3d065aac2da992e9327bba036e236468b73 (diff)
downloadsrc-4c066cf9f1ad3497d4a62b2af45e84d35b89577a.tar.gz
src-4c066cf9f1ad3497d4a62b2af45e84d35b89577a.zip
Don't treat two or more whitespace followed by a comment as
an empty argument PR: 20937 (maybe) PR: 20938
Notes
Notes: svn path=/head/; revision=65264
Diffstat (limited to 'usr.sbin/ppp/defs.c')
-rw-r--r--usr.sbin/ppp/defs.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c
index a77823c35794..033ec1410593 100644
--- a/usr.sbin/ppp/defs.c
+++ b/usr.sbin/ppp/defs.c
@@ -302,20 +302,25 @@ MakeArgs(char *script, char **pvect, int maxargs, int flags)
int nargs;
nargs = 0;
- while (*script && (*script != '#' || (flags & PARSE_NOHASH))) {
+ while (*script) {
script += strspn(script, " \t");
+ if (*script == '#' && flags & PARSE_NOHASH) {
+ *script = '\0';
+ break;
+ }
if (*script) {
if (nargs >= maxargs - 1)
- break;
+ break;
*pvect++ = script;
nargs++;
script = findblank(script, flags);
if (script == NULL)
return -1;
- else if (!(flags & PARSE_NOHASH) && *script == '#')
- *script = '\0';
- else if (*script)
- *script++ = '\0';
+ else if (!(flags & PARSE_NOHASH) && *script == '#') {
+ *script = '\0';
+ nargs--;
+ } else if (*script)
+ *script++ = '\0';
}
}
*pvect = NULL;