summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2000-08-30 22:04:57 +0000
committerbrian <brian@cvs.openbsd.org>2000-08-30 22:04:57 +0000
commit37c723c8ac7ff43300d01ef61c149916b1eed546 (patch)
tree8d9558eb1cde7d2c74648a9a92e0146c13303470
parent16f441cd668671b8e38c807ffcc3bd17c0609e58 (diff)
Don't treat two or more whitespace followed by a comment as
an empty argument
-rw-r--r--usr.sbin/ppp/ppp/defs.c19
1 files 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;