From b96d955fcac9315b51bd01025be303eabf0cdfc6 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 19 Feb 2001 04:43:21 +0000 Subject: ${BDECFLAGS} work. And fix a real error in the process. A "MAXUSERS" string could have been passed to free(); There are some warnings here I am not sure how to fix as they are in the lex scanner code, etc. --- usr.sbin/config/Makefile | 2 +- usr.sbin/config/config.h | 4 ++-- usr.sbin/config/config.y | 4 ++-- usr.sbin/config/lang.l | 2 +- usr.sbin/config/main.c | 9 ++++----- usr.sbin/config/mkmakefile.c | 16 ++++++++-------- usr.sbin/config/mkoptions.c | 5 +++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/usr.sbin/config/Makefile b/usr.sbin/config/Makefile index 5388abc..7ec44fe 100644 --- a/usr.sbin/config/Makefile +++ b/usr.sbin/config/Makefile @@ -3,7 +3,7 @@ PROG= config CFLAGS+=-I. -I${.CURDIR} -CFLAGS+=-Wall -Wunused -Wmissing-prototypes -Wredundant-decls +CFLAGS+=${BDECFLAGS} SRCS= config.y main.c lang.l mkmakefile.c mkheaders.c \ mkoptions.c y.tab.h MAN8= config.8 diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index 76a1d25..594480e 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -131,9 +131,9 @@ extern int hintmode; char *get_word(FILE *); char *get_quoted_word(FILE *); -char *path(char *); +char *path(const char *); char *raisestr(char *); -void remember(char *); +void remember(const char *); void moveifchanged(const char *, const char *); void newbus_ioconf(void); int yyparse(void); diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 52f77c0..d6247be 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -84,7 +84,7 @@ int maxusers; #define ns(s) strdup(s) -static void yyerror(char *s); +static void yyerror(const char *s); static char * devopt(char *dev) @@ -283,7 +283,7 @@ Device_spec: %% static void -yyerror(char *s) +yyerror(const char *s) { errx(1, "line %d: %s", yyline + 1, s); diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l index 0b6ad07..b968772 100644 --- a/usr.sbin/config/lang.l +++ b/usr.sbin/config/lang.l @@ -47,7 +47,7 @@ */ struct kt { - char *kt_name; + const char *kt_name; int kt_val; } key_words[] = { { "config", CONFIG }, diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index acc5647..4f8e77b 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -306,7 +306,7 @@ begin: * prepend the path to a filename */ char * -path(char *file) +path(const char *file) { char *cp = NULL; @@ -452,16 +452,15 @@ cleanheaders(char *p) } void -remember(char *file) +remember(const char *file) { char *s; struct hdr_list *hl; if ((s = strrchr(file, '/')) != NULL) - s++; + s = ns(s + 1); else - s = file; - s = ns(s); + s = ns(file); if (index(s, '_') && strncmp(s, "opt_", 4) != 0) { free(s); diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 24768ed..b7700d4 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -77,7 +77,7 @@ static void do_rules(FILE *); static void do_xxfiles(char *, FILE *); static void do_objs(FILE *); static void do_before_depend(FILE *); -static int opteq(char *, char *); +static int opteq(const char *, const char *); static void read_files(void); /* @@ -281,7 +281,7 @@ read_files(void) struct device *dp; struct device *save_dp; struct opt *op; - char *wd, *this, *needs, *special, *depends, *clean, *warn; + char *wd, *this, *needs, *special, *depends, *clean, *warning; char fname[MAXPATHLEN]; int ddwarned = 0; int nreqs, first = 1, configdep, isdup, std, filetype, @@ -364,7 +364,7 @@ next: special = 0; depends = 0; clean = 0; - warn = 0; + warning = 0; configdep = 0; needs = 0; std = mandatory = 0; @@ -451,7 +451,7 @@ nextparam: fname, this); exit(1); } - warn = ns(wd); + warning = ns(wd); goto nextparam; } nreqs++; @@ -519,7 +519,7 @@ invis: tp->f_special = special; tp->f_depends = depends; tp->f_clean = clean; - tp->f_warn = warn; + tp->f_warn = warning; goto next; doneparam: @@ -559,14 +559,14 @@ doneparam: tp->f_special = special; tp->f_depends = depends; tp->f_clean = clean; - tp->f_warn = warn; + tp->f_warn = warning; if (pf && pf->f_type == INVISIBLE) pf->f_flags |= ISDUP; /* mark as duplicate */ goto next; } static int -opteq(char *cp, char *dp) +opteq(const char *cp, const char *dp) { char c, d; @@ -725,7 +725,7 @@ do_rules(FILE *f) tp = tail(np); special = ftp->f_special; if (special == 0) { - char *ftype = NULL; + const char *ftype = NULL; static char cmd[128]; switch (ftp->f_type) { diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index 5ff8c54..1b8b332 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -92,7 +92,7 @@ options(void) /* Fake MAXUSERS as an option. */ op = (struct opt *)malloc(sizeof(*op)); memset(op, 0, sizeof(*op)); - op->op_name = "MAXUSERS"; + op->op_name = ns("MAXUSERS"); snprintf(buf, sizeof(buf), "%d", maxusers); op->op_value = ns(buf); op->op_next = opt; @@ -117,7 +117,8 @@ options(void) static void do_option(char *name) { - char *basefile, *file, *inw; + char *file, *inw; + const char *basefile; struct opt_list *ol; struct opt *op, *op_head, *topp; FILE *inf, *outf; -- cgit v1.1