From 37c723c8ac7ff43300d01ef61c149916b1eed546 Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 30 Aug 2000 22:04:57 +0000 Subject: Don't treat two or more whitespace followed by a comment as an empty argument --- usr.sbin/ppp/ppp/defs.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/usr.sbin/ppp/ppp/defs.c b/usr.sbin/ppp/ppp/defs.c index 3d643549a6e..6ca6f115ed7 100644 --- a/usr.sbin/ppp/ppp/defs.c +++ b/usr.sbin/ppp/ppp/defs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: defs.c,v 1.14 2000/08/29 16:47:04 brian Exp $ + * $OpenBSD: defs.c,v 1.15 2000/08/30 22:04:56 brian Exp $ */ @@ -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; -- cgit v1.2.3