summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/defs.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-30 20:51:13 +0000
committerbrian <brian@FreeBSD.org>2000-08-30 20:51:13 +0000
commit543225026f371845ba9f8c75313b688c1a820cb7 (patch)
tree4c86f439861ef813630dfc7fcdf6bf449ecbc923 /usr.sbin/ppp/defs.c
parent50a3c4fd88aad613b575bf8a49d0cda2de148164 (diff)
downloadFreeBSD-src-543225026f371845ba9f8c75313b688c1a820cb7.zip
FreeBSD-src-543225026f371845ba9f8c75313b688c1a820cb7.tar.gz
Don't treat two or more whitespace followed by a comment as
an empty argument PR: 20937 (maybe) PR: 20938
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 a77823c..033ec14 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;
OpenPOWER on IntegriCloud