summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/config.y
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-01-19 12:49:21 +0000
committerpeter <peter@FreeBSD.org>2001-01-19 12:49:21 +0000
commit8f5a6de0b62bf1be534914ddf0b7c32f5b2f1e19 (patch)
tree537458d2e93b2019974b888ee32aae6e144f4bf0 /usr.sbin/config/config.y
parentba149939207ce4c206d58e687022953e98b9c07f (diff)
downloadFreeBSD-src-8f5a6de0b62bf1be534914ddf0b7c32f5b2f1e19.zip
FreeBSD-src-8f5a6de0b62bf1be534914ddf0b7c32f5b2f1e19.tar.gz
Implement option strings that we can use in #ifdefs (where unavoidable)
as a replacement for the evil #define NFOO. If 'device npx' is in the static kernel, a synthetic option '#define DEV_NPX 1' will be available to stick in an opt_xxx.h file. "#if NNPX > 0" can be replaced with "#ifdef DEV_NPX" and we can get rid of the overloaded meaning of the device count mechanism.
Diffstat (limited to 'usr.sbin/config/config.y')
-rw-r--r--usr.sbin/config/config.y25
1 files changed, 25 insertions, 0 deletions
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
index 4c9a448..0354527 100644
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -86,6 +86,15 @@ int maxusers;
static void yyerror(char *s);
+static char *
+devopt(char *dev)
+{
+ char *ret = malloc(strlen(dev) + 5);
+
+ sprintf(ret, "DEV_%s", dev);
+ raisestr(ret);
+ return ret;
+}
%}
%%
@@ -260,12 +269,28 @@ Dev:
Device_spec:
DEVICE Dev
= {
+ struct opt *op = (struct opt *)malloc(sizeof (struct opt));
+ memset(op, 0, sizeof(*op));
+ op->op_name = devopt($2);
+ op->op_next = opt;
+ op->op_value = ns("1");
+ op->op_line = yyline;
+ opt = op;
+ /* and the device part */
cur.d_type = DEVICE;
cur.d_name = $2;
cur.d_count = UNKNOWN;
} |
DEVICE Dev NUMBER
= {
+ struct opt *op = (struct opt *)malloc(sizeof (struct opt));
+ memset(op, 0, sizeof(*op));
+ op->op_name = devopt($2);
+ op->op_next = opt;
+ op->op_value = ns("1");
+ op->op_line = yyline;
+ opt = op;
+ /* and the device part */
cur.d_type = DEVICE;
cur.d_name = $2;
cur.d_count = $3;
OpenPOWER on IntegriCloud