aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1999-12-23 21:43:12 +0000
committerBrian Somers <brian@FreeBSD.org>1999-12-23 21:43:12 +0000
commit1bbd8362c742552618d2d3ed34370a349b470d7f (patch)
tree112249a4a18b58d1e00c33c1cde322083786bfdf /usr.sbin
parent90e7fb01dfc6b7bb7e22b095b5a88ae9378486e0 (diff)
downloadsrc-1bbd8362c742552618d2d3ed34370a349b470d7f.tar.gz
src-1bbd8362c742552618d2d3ed34370a349b470d7f.zip
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/defs.c28
-rw-r--r--usr.sbin/ppp/defs.h2
-rw-r--r--usr.sbin/ppp/systems.c2
3 files changed, 14 insertions, 18 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 == '#')
diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h
index c2184275b070..2cd375bb0619 100644
--- a/usr.sbin/ppp/defs.h
+++ b/usr.sbin/ppp/defs.h
@@ -98,5 +98,5 @@ extern int Nam2mode(const char *);
extern struct in_addr GetIpAddr(const char *);
extern int SpeedToInt(speed_t);
extern speed_t IntToSpeed(int);
-extern char *findblank(char *, int, int);
+extern char *findblank(char *, int);
extern int MakeArgs(char *, char **, int, int);
diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c
index 5c70a79522ad..9574648212e9 100644
--- a/usr.sbin/ppp/systems.c
+++ b/usr.sbin/ppp/systems.c
@@ -267,7 +267,7 @@ GetLabel(char *line, const char *filename, int linenum)
{
char *wp;
- if ((wp = findblank(line, 0, 1)) != NULL) {
+ if ((wp = findblank(line, 1)) != NULL) {
while (issep(*wp))
*wp++ = '\0';
if (*wp == '#')