summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 67472c4..31d355e 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 c218427..2cd375b 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 5c70a79..9574648 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 == '#')
OpenPOWER on IntegriCloud