diff options
| author | Brian Somers <brian@FreeBSD.org> | 1999-12-23 21:43:12 +0000 |
|---|---|---|
| committer | Brian Somers <brian@FreeBSD.org> | 1999-12-23 21:43:12 +0000 |
| commit | 1bbd8362c742552618d2d3ed34370a349b470d7f (patch) | |
| tree | 112249a4a18b58d1e00c33c1cde322083786bfdf /usr.sbin/ppp/defs.c | |
| parent | 90e7fb01dfc6b7bb7e22b095b5a88ae9378486e0 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/ppp/defs.c')
| -rw-r--r-- | usr.sbin/ppp/defs.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c index 67472c4754f9..31d355e2b802 100644 --- a/usr.sbin/ppp/defs.c +++ b/usr.sbin/ppp/defs.c @@ -264,8 +264,11 @@ IntToSpeed(int nspeed) } char * -findblank(char *p, int instring, int reduce) +findblank(char *p, int reduce) { + int instring; + + instring = 0; while (*p) { if (*p == '\\') { if (reduce) { @@ -274,8 +277,11 @@ findblank(char *p, int instring, int reduce) break; } else p++; - } else if ((instring && *p == '"') || - (!instring && (issep(*p) || *p == '#'))) + } else if (*p == '"') { + memmove(p, p + 1, strlen(p)); + instring = !instring; + continue; + } else if (!instring && (issep(*p) || *p == '#')) return p; p++; } @@ -286,27 +292,17 @@ findblank(char *p, int instring, int reduce) int MakeArgs(char *script, char **pvect, int maxargs, int reduce) { - int nargs, nb; - int instring; + int nargs; nargs = 0; while (*script) { - nb = strspn(script, " \t"); - script += nb; + script += strspn(script, " \t"); if (*script) { - if (*script == '"') { - instring = 1; - script++; - if (*script == '\0') - break; /* Shouldn't return here. Need to NULL - * terminate below */ - } else - instring = 0; if (nargs >= maxargs - 1) break; *pvect++ = script; nargs++; - script = findblank(script, instring, reduce); + script = findblank(script, reduce); if (script == NULL) return -1; else if (*script == '#') |
