svn commit: r276280 - stable/10/usr.sbin/config
Ian Lepore
ian at FreeBSD.org
Sat Dec 27 03:19:05 UTC 2014
Author: ian
Date: Sat Dec 27 03:19:04 2014
New Revision: 276280
URL: https://svnweb.freebsd.org/changeset/base/276280
Log:
MFC r274924, r274936:
Consider the negation operator (!) to be a word even if it is not followed
by whitespace. This allows "optional !foo" which is what most programmers
are naturally going to tend to do as opposed to "optional ! foo".
Fix the negation (!) operator so that it binds only to the word that
immediately follows it.
Modified:
stable/10/usr.sbin/config/main.c
stable/10/usr.sbin/config/mkmakefile.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/usr.sbin/config/main.c
==============================================================================
--- stable/10/usr.sbin/config/main.c Sat Dec 27 03:01:19 2014 (r276279)
+++ stable/10/usr.sbin/config/main.c Sat Dec 27 03:19:04 2014 (r276280)
@@ -314,6 +314,11 @@ begin:
}
cp = line;
*cp++ = ch;
+ /* Negation operator is a word by itself. */
+ if (ch == '!') {
+ *cp = 0;
+ return (line);
+ }
while ((ch = getc(fp)) != EOF) {
if (isspace(ch))
break;
Modified: stable/10/usr.sbin/config/mkmakefile.c
==============================================================================
--- stable/10/usr.sbin/config/mkmakefile.c Sat Dec 27 03:01:19 2014 (r276279)
+++ stable/10/usr.sbin/config/mkmakefile.c Sat Dec 27 03:19:04 2014 (r276280)
@@ -386,13 +386,9 @@ next:
if (nreqs == 0)
errout("%s: syntax error describing %s\n",
fname, this);
- if (not)
- compile += !match;
- else
- compile += match;
+ compile += match;
match = 1;
nreqs = 0;
- not = 0;
continue;
}
if (eq(wd, "no-obj")) {
@@ -474,19 +470,23 @@ next:
this, wd);
STAILQ_FOREACH(dp, &dtab, d_next)
if (eq(dp->d_name, wd)) {
- dp->d_done |= DEVDONE;
+ if (not)
+ match = 0;
+ else
+ dp->d_done |= DEVDONE;
goto nextparam;
}
SLIST_FOREACH(op, &opt, op_next)
- if (op->op_value == 0 && opteq(op->op_name, wd))
+ if (op->op_value == 0 && opteq(op->op_name, wd)) {
+ if (not)
+ match = 0;
goto nextparam;
- match = 0;
+ }
+ match &= not;
nextparam:;
+ not = 0;
}
- if (not)
- compile += !match;
- else
- compile += match;
+ compile += match;
if (compile && tp == NULL) {
if (std == 0 && nreqs == 0)
errout("%s: what is %s optional on?\n",
More information about the svn-src-stable-10
mailing list