summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/systems.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-12-27 11:43:31 +0000
committerbrian <brian@FreeBSD.org>1999-12-27 11:43:31 +0000
commit8d3683f53b3d5744a2026aa9b81196dd6a4a4a1b (patch)
tree94166715268d35a6faf276b4828f0f243857c33c /usr.sbin/ppp/systems.c
parent216d01507f39e9ea892e22ba17d9f7bc780aca8b (diff)
downloadFreeBSD-src-8d3683f53b3d5744a2026aa9b81196dd6a4a4a1b.zip
FreeBSD-src-8d3683f53b3d5744a2026aa9b81196dd6a4a4a1b.tar.gz
Don't allowt '#' as a comment when it's embedded in quotes:
set something "xxx yyy # zzz" aaa shouldn't be interpreted as set something "xxx yyy" aaa
Diffstat (limited to 'usr.sbin/ppp/systems.c')
-rw-r--r--usr.sbin/ppp/systems.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c
index 9574648..a570ceb 100644
--- a/usr.sbin/ppp/systems.c
+++ b/usr.sbin/ppp/systems.c
@@ -265,28 +265,22 @@ xgets(char *buf, int buflen, FILE *fp)
static char *
GetLabel(char *line, const char *filename, int linenum)
{
- char *wp;
-
- if ((wp = findblank(line, 1)) != NULL) {
- while (issep(*wp))
- *wp++ = '\0';
- if (*wp == '#')
- *wp = '\0';
- if (*wp != '\0') {
- log_Printf(LogWARN, "Bad label in %s (line %d) - too many words.\n",
- filename, linenum);
- return NULL;
- }
- }
- wp = strchr(line, ':');
- if (wp == NULL || wp[1] != '\0') {
- log_Printf(LogWARN, "Bad rule in %s (line %d) - missing colon.\n",
+ char *argv[MAXARGS];
+ int argc, len;
+
+ argc = MakeArgs(line, argv, MAXARGS, PARSE_REDUCE);
+
+ if (argc == 2 && !strcmp(argv[1], ":"))
+ return argv[0];
+
+ if (argc != 1 || (len = strlen(argv[0])) < 2 || argv[0][len-1] != ':') {
+ log_Printf(LogWARN, "Bad label in %s (line %d) - missing colon\n",
filename, linenum);
return NULL;
}
- *wp = '\0';
+ argv[0][len-1] = '\0'; /* Lose the ':' */
- return line;
+ return argv[0];
}
/* Returns -2 for ``file not found'' and -1 for ``label not found'' */
@@ -349,7 +343,6 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file,
default:
if ((cp = GetLabel(cp, filename, linenum)) == NULL)
continue;
- cp = strip(cp); /* lose any spaces between the label and the ':' */
if (strcmp(cp, name) == 0) {
/* We're in business */
@@ -365,7 +358,7 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file,
if (!indent) { /* start of next section */
if (*cp != '!' && how == SYSTEM_EXEC)
- GetLabel(cp, filename, linenum);
+ cp = GetLabel(cp, filename, linenum);
break;
}
OpenPOWER on IntegriCloud