nuke __P, and convert all functions to use ANSI-style declarations.

Also, do a few trivial KNF cleanups (e.g. newline at start of fn if no
locals).  Verified to have no effect via diff on new and old compiled
binaries.
This commit is contained in:
cgd 2000-10-02 19:48:34 +00:00
parent cac9995776
commit 463d864ef0
15 changed files with 365 additions and 587 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: config.h,v 1.48 2000/10/02 18:59:03 cgd Exp $ */ /* $NetBSD: config.h,v 1.49 2000/10/02 19:48:34 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -54,9 +54,7 @@
#if !defined(MAKE_BOOTSTRAP) && defined(BSD) #if !defined(MAKE_BOOTSTRAP) && defined(BSD)
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <paths.h> #include <paths.h>
#else /* ...BSD */ #endif
#define __P(protos) protos /* full-blown ANSI C */
#endif /* ...BSD */
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -360,39 +358,39 @@ struct { /* loc[] table for config */
} locators; } locators;
/* files.c */ /* files.c */
void initfiles __P((void)); void initfiles(void);
void checkfiles __P((void)); void checkfiles(void);
int fixfiles __P((void)); /* finalize */ int fixfiles(void); /* finalize */
int fixobjects __P((void)); int fixobjects(void);
void addfile __P((const char *, struct nvlist *, int, const char *)); void addfile(const char *, struct nvlist *, int, const char *);
void addobject __P((const char *, struct nvlist *, int)); void addobject(const char *, struct nvlist *, int);
/* hash.c */ /* hash.c */
struct hashtab *ht_new __P((void)); struct hashtab *ht_new(void);
int ht_insrep __P((struct hashtab *, const char *, void *, int)); int ht_insrep(struct hashtab *, const char *, void *, int);
#define ht_insert(ht, nam, val) ht_insrep(ht, nam, val, 0) #define ht_insert(ht, nam, val) ht_insrep(ht, nam, val, 0)
#define ht_replace(ht, nam, val) ht_insrep(ht, nam, val, 1) #define ht_replace(ht, nam, val) ht_insrep(ht, nam, val, 1)
void *ht_lookup __P((struct hashtab *, const char *)); void *ht_lookup(struct hashtab *, const char *);
void initintern __P((void)); void initintern(void);
const char *intern __P((const char *)); const char *intern(const char *);
typedef int (*ht_callback) __P((const char *, void *, void *)); typedef int (*ht_callback)(const char *, void *, void *);
int ht_enumerate __P((struct hashtab *, ht_callback, void *)); int ht_enumerate(struct hashtab *, ht_callback, void *);
/* main.c */ /* main.c */
void addoption __P((const char *name, const char *value)); void addoption(const char *name, const char *value);
void addfsoption __P((const char *name)); void addfsoption(const char *name);
void addmkoption __P((const char *name, const char *value)); void addmkoption(const char *name, const char *value);
void deffilesystem __P((const char *fname, struct nvlist *fses)); void deffilesystem(const char *fname, struct nvlist *fses);
void defoption __P((const char *fname, struct nvlist *opts, void defoption(const char *fname, struct nvlist *opts,
struct nvlist *deps)); struct nvlist *deps);
void defflag __P((const char *fname, struct nvlist *opts, void defflag(const char *fname, struct nvlist *opts,
struct nvlist *deps)); struct nvlist *deps);
void defparam __P((const char *fname, struct nvlist *opts, void defparam(const char *fname, struct nvlist *opts,
struct nvlist *deps)); struct nvlist *deps);
int devbase_has_instances __P((struct devbase *, int)); int devbase_has_instances(struct devbase *, int);
struct nvlist * find_declared_option __P((const char *name)); struct nvlist * find_declared_option(const char *name);
int deva_has_instances __P((struct deva *, int)); int deva_has_instances(struct deva *, int);
void setupdirs __P((void)); void setupdirs(void);
/* tests on option types */ /* tests on option types */
#define OPT_FSOPT(n) (ht_lookup(deffstab, (n)) != NULL) #define OPT_FSOPT(n) (ht_lookup(deffstab, (n)) != NULL)
@ -403,44 +401,43 @@ void setupdirs __P((void));
/* mkheaders.c */ /* mkheaders.c */
int mkheaders __P((void)); int mkheaders(void);
/* mkioconf.c */ /* mkioconf.c */
int mkioconf __P((void)); int mkioconf(void);
/* mkmakefile.c */ /* mkmakefile.c */
int mkmakefile __P((void)); int mkmakefile(void);
/* mkswap.c */ /* mkswap.c */
int mkswap __P((void)); int mkswap(void);
/* pack.c */ /* pack.c */
void pack __P((void)); void pack(void);
/* scan.l */ /* scan.l */
int currentline __P((void)); int currentline(void);
int firstfile __P((const char *)); int firstfile(const char *);
int include __P((const char *, int, int)); int include(const char *, int, int);
/* sem.c, other than for yacc actions */ /* sem.c, other than for yacc actions */
void initsem __P((void)); void initsem(void);
/* util.c */ /* util.c */
void *emalloc __P((size_t)); void *emalloc(size_t);
void *erealloc __P((void *, size_t)); void *erealloc(void *, size_t);
char *estrdup __P((const char *)); char *estrdup(const char *);
void prefix_push __P((const char *)); void prefix_push(const char *);
void prefix_pop __P((void)); void prefix_pop(void);
char *sourcepath __P((const char *)); char *sourcepath(const char *);
void warn __P((const char *, ...)); /* immediate warns */ void warn(const char *, ...); /* immediate warns */
void error __P((const char *, ...)); /* immediate errs */ void error(const char *, ...); /* immediate errs */
void xerror __P((const char *, int, const char *, ...)); /* delayed errs */ void xerror(const char *, int, const char *, ...); /* delayed errs */
__dead void panic __P((const char *, ...)); __dead void panic(const char *, ...);
struct nvlist *newnv __P((const char *, const char *, void *, int, struct nvlist *newnv(const char *, const char *, void *, int, struct nvlist *);
struct nvlist *)); void nvfree(struct nvlist *);
void nvfree __P((struct nvlist *)); void nvfreel(struct nvlist *);
void nvfreel __P((struct nvlist *));
/* liby */ /* liby */
void yyerror __P((const char *)); void yyerror(const char *);
int yylex __P((void)); int yylex(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: files.c,v 1.12 2000/06/09 05:06:12 cgd Exp $ */ /* $NetBSD: files.c,v 1.13 2000/10/02 19:48:34 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -67,16 +67,16 @@ static struct files **unchecked;
static struct objects **nextobject; static struct objects **nextobject;
static int checkaux __P((const char *, void *)); static int checkaux(const char *, void *);
static int fixcount __P((const char *, void *)); static int fixcount(const char *, void *);
static int fixfsel __P((const char *, void *)); static int fixfsel(const char *, void *);
static int fixsel __P((const char *, void *)); static int fixsel(const char *, void *);
static int expr_eval __P((struct nvlist *, static int expr_eval(struct nvlist *,
int (*)(const char *, void *), void *)); int (*)(const char *, void *), void *);
static void expr_free __P((struct nvlist *)); static void expr_free(struct nvlist *);
void void
initfiles() initfiles(void)
{ {
basetab = ht_new(); basetab = ht_new();
@ -87,11 +87,7 @@ initfiles()
} }
void void
addfile(path, optx, flags, rule) addfile(const char *path, struct nvlist *optx, int flags, const char *rule)
const char *path;
struct nvlist *optx;
int flags;
const char *rule;
{ {
struct files *fi; struct files *fi;
const char *dotp, *tail; const char *dotp, *tail;
@ -173,10 +169,7 @@ bad:
} }
void void
addobject(path, optx, flags) addobject(const char *path, struct nvlist *optx, int flags)
const char *path;
struct nvlist *optx;
int flags;
{ {
struct objects *oi; struct objects *oi;
@ -213,7 +206,7 @@ addobject(path, optx, flags)
* depending on some machine-specific device.) * depending on some machine-specific device.)
*/ */
void void
checkfiles() checkfiles(void)
{ {
struct files *fi, *last; struct files *fi, *last;
@ -230,9 +223,7 @@ checkfiles()
* We are not actually interested in the expression's value. * We are not actually interested in the expression's value.
*/ */
static int static int
checkaux(name, context) checkaux(const char *name, void *context)
const char *name;
void *context;
{ {
struct files *fi = context; struct files *fi = context;
@ -252,7 +243,7 @@ checkaux(name, context)
* from the selected sources do not collide. * from the selected sources do not collide.
*/ */
int int
fixfiles() fixfiles(void)
{ {
struct files *fi, *ofi; struct files *fi, *ofi;
struct nvlist *flathead, **flatp; struct nvlist *flathead, **flatp;
@ -312,7 +303,7 @@ fixfiles()
* selection. * selection.
*/ */
int int
fixobjects() fixobjects(void)
{ {
struct objects *oi; struct objects *oi;
struct nvlist *flathead, **flatp; struct nvlist *flathead, **flatp;
@ -348,9 +339,7 @@ fixobjects()
* are called to eval each atom. * are called to eval each atom.
*/ */
static int static int
fixcount(name, context) fixcount(const char *name, void *context)
const char *name;
void *context;
{ {
struct nvlist ***p = context; struct nvlist ***p = context;
struct devbase *dev; struct devbase *dev;
@ -371,9 +360,7 @@ fixcount(name, context)
* file that will generate a .h with flags. We will need the flat list. * file that will generate a .h with flags. We will need the flat list.
*/ */
static int static int
fixfsel(name, context) fixfsel(const char *name, void *context)
const char *name;
void *context;
{ {
struct nvlist ***p = context; struct nvlist ***p = context;
struct nvlist *nv; struct nvlist *nv;
@ -390,9 +377,7 @@ fixfsel(name, context)
* As for fixfsel above, but we do not need the flat list. * As for fixfsel above, but we do not need the flat list.
*/ */
static int static int
fixsel(name, context) fixsel(const char *name, void *context)
const char *name;
void *context;
{ {
return (ht_lookup(selecttab, name) != NULL); return (ht_lookup(selecttab, name) != NULL);
@ -407,10 +392,7 @@ fixsel(name, context)
* our mixing of C's bitwise & boolean here may give surprises). * our mixing of C's bitwise & boolean here may give surprises).
*/ */
static int static int
expr_eval(expr, fn, context) expr_eval(struct nvlist *expr, int (*fn)(const char *, void *), void *context)
struct nvlist *expr;
int (*fn) __P((const char *, void *));
void *context;
{ {
int lhs, rhs; int lhs, rhs;
@ -441,8 +423,7 @@ expr_eval(expr, fn, context)
* Free an expression tree. * Free an expression tree.
*/ */
static void static void
expr_free(expr) expr_free(struct nvlist *expr)
struct nvlist *expr;
{ {
struct nvlist *rhs; struct nvlist *rhs;
@ -474,8 +455,7 @@ expr_free(expr)
* Print expression tree. * Print expression tree.
*/ */
void void
prexpr(expr) prexpr(struct nvlist *expr)
struct nvlist *expr;
{ {
static void pr0(); static void pr0();
@ -486,8 +466,7 @@ prexpr(expr)
} }
static void static void
pr0(e) pr0(struct nvlist *e)
struct nvlist *e;
{ {
switch (e->nv_int) { switch (e->nv_int) {

View File

@ -1,5 +1,5 @@
%{ %{
/* $NetBSD: gram.y,v 1.28 2000/01/23 23:37:42 hubertf Exp $ */ /* $NetBSD: gram.y,v 1.29 2000/10/02 19:48:34 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -81,14 +81,14 @@ static int adepth;
#define fx_and(e1, e2) new0(NULL, NULL, e1, FX_AND, e2) #define fx_and(e1, e2) new0(NULL, NULL, e1, FX_AND, e2)
#define fx_or(e1, e2) new0(NULL, NULL, e1, FX_OR, e2) #define fx_or(e1, e2) new0(NULL, NULL, e1, FX_OR, e2)
static void cleanup __P((void)); static void cleanup(void);
static void setmachine __P((const char *, const char *)); static void setmachine(const char *, const char *);
static void check_maxpart __P((void)); static void check_maxpart(void);
static void app __P((struct nvlist *, struct nvlist *)); static void app(struct nvlist *, struct nvlist *);
static struct nvlist *mk_nsis __P((const char *, int, struct nvlist *, int)); static struct nvlist *mk_nsis(const char *, int, struct nvlist *, int);
static struct nvlist *mk_ns __P((const char *, struct nvlist *)); static struct nvlist *mk_ns(const char *, struct nvlist *);
%} %}
@ -480,8 +480,7 @@ flags_opt:
%% %%
void void
yyerror(s) yyerror(const char *s)
const char *s;
{ {
error("%s", s); error("%s", s);
@ -492,7 +491,7 @@ yyerror(s)
* allocated during parsing the current line. * allocated during parsing the current line.
*/ */
static void static void
cleanup() cleanup(void)
{ {
struct nvlist **np; struct nvlist **np;
int i; int i;
@ -503,9 +502,7 @@ cleanup()
} }
static void static void
setmachine(mch, mcharch) setmachine(const char *mch, const char *mcharch)
const char *mch;
const char *mcharch;
{ {
char buf[MAXPATHLEN]; char buf[MAXPATHLEN];
@ -529,16 +526,16 @@ setmachine(mch, mcharch)
} }
static void static void
check_maxpart() check_maxpart(void)
{ {
if (maxpartitions <= 0) { if (maxpartitions <= 0) {
stop("cannot proceed without maxpartitions specifier"); stop("cannot proceed without maxpartitions specifier");
} }
} }
static void static void
app(p, q) app(struct nvlist *p, struct nvlist *q)
struct nvlist *p, *q;
{ {
while (p->nv_next) while (p->nv_next)
p = p->nv_next; p = p->nv_next;
@ -546,11 +543,7 @@ app(p, q)
} }
static struct nvlist * static struct nvlist *
mk_nsis(name, count, adefs, opt) mk_nsis(const char *name, int count, struct nvlist *adefs, int opt)
const char *name;
int count;
struct nvlist *adefs;
int opt;
{ {
struct nvlist *defs = adefs; struct nvlist *defs = adefs;
struct nvlist **p; struct nvlist **p;
@ -576,9 +569,7 @@ mk_nsis(name, count, adefs, opt)
static struct nvlist * static struct nvlist *
mk_ns(name, vals) mk_ns(const char *name, struct nvlist *vals)
const char *name;
struct nvlist *vals;
{ {
struct nvlist *p; struct nvlist *p;
char buf[200]; char buf[200];

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.6 1997/10/18 07:59:15 lukem Exp $ */ /* $NetBSD: hash.c,v 1.7 2000/10/02 19:48:34 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -89,18 +89,17 @@ static struct hashtab strings;
/* round up to next multiple of y, where y is a power of 2 */ /* round up to next multiple of y, where y is a power of 2 */
#define ROUND(x, y) (((x) + (y) - 1) & ~((y) - 1)) #define ROUND(x, y) (((x) + (y) - 1) & ~((y) - 1))
static void *poolalloc __P((size_t)); static void *poolalloc(size_t);
static void ht_expand __P((struct hashtab *)); static void ht_expand(struct hashtab *);
static void ht_init __P((struct hashtab *, size_t)); static void ht_init(struct hashtab *, size_t);
static inline u_int hash __P((const char *)); static inline u_int hash(const char *);
static inline struct hashent *newhashent __P((const char *, u_int)); static inline struct hashent *newhashent(const char *, u_int);
/* /*
* Allocate space that will never be freed. * Allocate space that will never be freed.
*/ */
static void * static void *
poolalloc(size) poolalloc(size_t size)
size_t size;
{ {
char *p; char *p;
size_t alloc; size_t alloc;
@ -128,9 +127,7 @@ poolalloc(size)
* Initialize a new hash table. The size must be a power of 2. * Initialize a new hash table. The size must be a power of 2.
*/ */
static void static void
ht_init(ht, sz) ht_init(struct hashtab *ht, size_t sz)
struct hashtab *ht;
size_t sz;
{ {
struct hashent **h; struct hashent **h;
u_int n; u_int n;
@ -149,8 +146,7 @@ ht_init(ht, sz)
* Expand an existing hash table. * Expand an existing hash table.
*/ */
static void static void
ht_expand(ht) ht_expand(struct hashtab *ht)
struct hashtab *ht;
{ {
struct hashent *p, **h, **oldh, *q; struct hashent *p, **h, **oldh, *q;
u_int n, i; u_int n, i;
@ -179,9 +175,7 @@ ht_expand(ht)
* Make a new hash entry, setting its h_next to NULL. * Make a new hash entry, setting its h_next to NULL.
*/ */
static inline struct hashent * static inline struct hashent *
newhashent(name, h) newhashent(const char *name, u_int h)
const char *name;
u_int h;
{ {
struct hashent *hp; struct hashent *hp;
char *m; char *m;
@ -198,8 +192,7 @@ newhashent(name, h)
* Hash a string. * Hash a string.
*/ */
static inline u_int static inline u_int
hash(str) hash(const char *str)
const char *str;
{ {
u_int h; u_int h;
@ -209,7 +202,7 @@ hash(str)
} }
void void
initintern() initintern(void)
{ {
ht_init(&strings, 128); ht_init(&strings, 128);
@ -220,8 +213,7 @@ initintern()
* function to be used frequently, so it should be fast. * function to be used frequently, so it should be fast.
*/ */
const char * const char *
intern(s) intern(const char *s)
const char *s;
{ {
struct hashtab *ht; struct hashtab *ht;
struct hashent *hp, **hpp; struct hashent *hp, **hpp;
@ -245,7 +237,7 @@ intern(s)
} }
struct hashtab * struct hashtab *
ht_new() ht_new(void)
{ {
struct hashtab *ht; struct hashtab *ht;
@ -258,11 +250,7 @@ ht_new()
* Insert and/or replace. * Insert and/or replace.
*/ */
int int
ht_insrep(ht, nam, val, replace) ht_insrep(struct hashtab *ht, const char *nam, void *val, int replace)
struct hashtab *ht;
const char *nam;
void *val;
int replace;
{ {
struct hashent *hp, **hpp; struct hashent *hp, **hpp;
u_int h; u_int h;
@ -284,9 +272,7 @@ ht_insrep(ht, nam, val, replace)
} }
void * void *
ht_lookup(ht, nam) ht_lookup(struct hashtab *ht, const char *nam)
struct hashtab *ht;
const char *nam;
{ {
struct hashent *hp, **hpp; struct hashent *hp, **hpp;
u_int h; u_int h;
@ -306,10 +292,7 @@ ht_lookup(ht, nam)
*/ */
int int
ht_enumerate(ht, cbfunc, arg) ht_enumerate(struct hashtab *ht, ht_callback cbfunc, void *arg)
struct hashtab *ht;
ht_callback cbfunc;
void *arg;
{ {
struct hashent *hp, **hpp; struct hashent *hp, **hpp;
u_int i; u_int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.47 2000/04/14 06:26:52 simonb Exp $ */ /* $NetBSD: main.c,v 1.48 2000/10/02 19:48:34 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
int vflag; /* verbose output */ int vflag; /* verbose output */
int yyparse __P((void)); int yyparse(void);
extern int yydebug; extern int yydebug;
@ -75,32 +75,29 @@ static struct nvlist **nextopt;
static struct nvlist **nextmkopt; static struct nvlist **nextmkopt;
static struct nvlist **nextfsopt; static struct nvlist **nextfsopt;
static void dependopts __P((void)); static void dependopts(void);
static void do_depend __P((struct nvlist *)); static void do_depend(struct nvlist *);
static void stop __P((void)); static void stop(void);
static int do_option __P((struct hashtab *, struct nvlist ***, static int do_option(struct hashtab *, struct nvlist ***,
const char *, const char *, const char *)); const char *, const char *, const char *);
static int crosscheck __P((void)); static int crosscheck(void);
static int badstar __P((void)); static int badstar(void);
int main __P((int, char **)); int main(int, char **);
static int mksymlinks __P((void)); static int mksymlinks(void);
static int mkident __P((void)); static int mkident(void);
static int hasparent __P((struct devi *)); static int hasparent(struct devi *);
static int cfcrosscheck __P((struct config *, const char *, static int cfcrosscheck(struct config *, const char *, struct nvlist *);
struct nvlist *)); void defopt(struct hashtab *ht, const char *fname,
void defopt __P((struct hashtab *ht, const char *fname, struct nvlist *opts, struct nvlist *deps);
struct nvlist *opts, struct nvlist *deps));
int badfilename __P((const char *fname)); int badfilename(const char *fname);
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
char *__progname; char *__progname;
#endif #endif
int int
main(argc, argv) main(int argc, char **argv)
int argc;
char **argv;
{ {
char *p; char *p;
const char *last_component; const char *last_component;
@ -285,7 +282,7 @@ usage:
* Set any options that are implied by other options. * Set any options that are implied by other options.
*/ */
static void static void
dependopts() dependopts(void)
{ {
struct nvlist *nv, *opt; struct nvlist *nv, *opt;
@ -300,8 +297,7 @@ dependopts()
} }
static void static void
do_depend(nv) do_depend(struct nvlist *nv)
struct nvlist *nv;
{ {
struct nvlist *nextnv; struct nvlist *nextnv;
@ -319,7 +315,7 @@ do_depend(nv)
* and for the machine's CPU architecture, so that works as well. * and for the machine's CPU architecture, so that works as well.
*/ */
static int static int
mksymlinks() mksymlinks(void)
{ {
int ret; int ret;
char *p, buf[MAXPATHLEN]; char *p, buf[MAXPATHLEN];
@ -359,7 +355,7 @@ mksymlinks()
} }
static __dead void static __dead void
stop() stop(void)
{ {
(void)fprintf(stderr, "*** Stop.\n"); (void)fprintf(stderr, "*** Stop.\n");
exit(1); exit(1);
@ -372,9 +368,7 @@ stop()
* Otherwise, no preprocessor #defines will be generated. * Otherwise, no preprocessor #defines will be generated.
*/ */
void void
deffilesystem(fname, fses) deffilesystem(const char *fname, struct nvlist *fses)
const char *fname;
struct nvlist *fses;
{ {
struct nvlist *nv; struct nvlist *nv;
@ -420,8 +414,7 @@ deffilesystem(fname, fses)
* Sanity check a file name. * Sanity check a file name.
*/ */
int int
badfilename(fname) badfilename(const char *fname)
const char *fname;
{ {
const char *n; const char *n;
@ -446,8 +439,7 @@ badfilename(fname)
* return the option's struct nvlist. * return the option's struct nvlist.
*/ */
struct nvlist * struct nvlist *
find_declared_option(name) find_declared_option(const char *name)
const char *name;
{ {
struct nvlist *option = NULL; struct nvlist *option = NULL;
@ -469,10 +461,8 @@ find_declared_option(name)
* record the option information in the specified table. * record the option information in the specified table.
*/ */
void void
defopt(ht, fname, opts, deps) defopt(struct hashtab *ht, const char *fname, struct nvlist *opts,
struct hashtab *ht; struct nvlist *deps)
const char *fname;
struct nvlist *opts, *deps;
{ {
struct nvlist *nv, *nextnv, *oldnv; struct nvlist *nv, *nextnv, *oldnv;
const char *name, *n; const char *name, *n;
@ -551,10 +541,9 @@ defopt(ht, fname, opts, deps)
* an option file for each option. * an option file for each option.
*/ */
void void
defoption(fname, opts, deps) defoption(const char *fname, struct nvlist *opts, struct nvlist *deps)
const char *fname;
struct nvlist *opts, *deps;
{ {
defopt(defopttab, fname, opts, deps); defopt(defopttab, fname, opts, deps);
} }
@ -563,10 +552,9 @@ defoption(fname, opts, deps)
* Define an option for which a value is required. * Define an option for which a value is required.
*/ */
void void
defparam(fname, opts, deps) defparam(const char *fname, struct nvlist *opts, struct nvlist *deps)
const char *fname;
struct nvlist *opts, *deps;
{ {
defopt(defparamtab, fname, opts, deps); defopt(defparamtab, fname, opts, deps);
} }
@ -575,10 +563,9 @@ defparam(fname, opts, deps)
* emits a "needs-flag" style output. * emits a "needs-flag" style output.
*/ */
void void
defflag(fname, opts, deps) defflag(const char *fname, struct nvlist *opts, struct nvlist *deps)
const char *fname;
struct nvlist *opts, *deps;
{ {
defopt(defflagtab, fname, opts, deps); defopt(defflagtab, fname, opts, deps);
} }
@ -588,8 +575,7 @@ defflag(fname, opts, deps)
* are "optional foo". * are "optional foo".
*/ */
void void
addoption(name, value) addoption(const char *name, const char *value)
const char *name, *value;
{ {
const char *n; const char *n;
char *p, c; char *p, c;
@ -644,8 +630,7 @@ addoption(name, value)
* file system type. The name is then treated like a standard option. * file system type. The name is then treated like a standard option.
*/ */
void void
addfsoption(name) addfsoption(const char *name)
const char *name;
{ {
const char *n; const char *n;
char *p, c; char *p, c;
@ -685,8 +670,7 @@ addfsoption(name)
* Add a "make" option. * Add a "make" option.
*/ */
void void
addmkoption(name, value) addmkoption(const char *name, const char *value)
const char *name, *value;
{ {
(void)do_option(mkopttab, &nextmkopt, name, value, "mkoptions"); (void)do_option(mkopttab, &nextmkopt, name, value, "mkoptions");
@ -696,10 +680,8 @@ addmkoption(name, value)
* Add a name=value pair to an option list. The value may be NULL. * Add a name=value pair to an option list. The value may be NULL.
*/ */
static int static int
do_option(ht, nppp, name, value, type) do_option(struct hashtab *ht, struct nvlist ***nppp, const char *name,
struct hashtab *ht; const char *value, const char *type)
struct nvlist ***nppp;
const char *name, *value, *type;
{ {
struct nvlist *nv; struct nvlist *nv;
@ -735,9 +717,7 @@ do_option(ht, nppp, name, value, type)
* on the given device attachment (or any units, if unit == WILD). * on the given device attachment (or any units, if unit == WILD).
*/ */
int int
deva_has_instances(deva, unit) deva_has_instances(struct deva *deva, int unit)
struct deva *deva;
int unit;
{ {
struct devi *i; struct devi *i;
@ -754,9 +734,7 @@ deva_has_instances(deva, unit)
* on the given base (or any units, if unit == WILD). * on the given base (or any units, if unit == WILD).
*/ */
int int
devbase_has_instances(dev, unit) devbase_has_instances(struct devbase *dev, int unit)
struct devbase *dev;
int unit;
{ {
struct deva *da; struct deva *da;
@ -767,8 +745,7 @@ devbase_has_instances(dev, unit)
} }
static int static int
hasparent(i) hasparent(struct devi *i)
struct devi *i;
{ {
struct nvlist *nv; struct nvlist *nv;
int atunit = i->i_atunit; int atunit = i->i_atunit;
@ -802,10 +779,7 @@ hasparent(i)
} }
static int static int
cfcrosscheck(cf, what, nv) cfcrosscheck(struct config *cf, const char *what, struct nvlist *nv)
struct config *cf;
const char *what;
struct nvlist *nv;
{ {
struct devbase *dev; struct devbase *dev;
struct devi *pd; struct devi *pd;
@ -849,7 +823,7 @@ loop:
* see that the root and dump devices for all configurations are there. * see that the root and dump devices for all configurations are there.
*/ */
int int
crosscheck() crosscheck(void)
{ {
struct devi *i; struct devi *i;
struct config *cf; struct config *cf;
@ -884,7 +858,7 @@ crosscheck()
* Check to see if there is a *'d unit with a needs-count file. * Check to see if there is a *'d unit with a needs-count file.
*/ */
int int
badstar() badstar(void)
{ {
struct devbase *d; struct devbase *d;
struct deva *da; struct deva *da;
@ -921,7 +895,7 @@ badstar()
* This will be called when we see the first include. * This will be called when we see the first include.
*/ */
void void
setupdirs() setupdirs(void)
{ {
struct stat st; struct stat st;
@ -965,7 +939,7 @@ setupdirs()
* newvers.sh to pick it up. * newvers.sh to pick it up.
*/ */
int int
mkident() mkident(void)
{ {
FILE *fp; FILE *fp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkheaders.c,v 1.24 1999/09/22 14:23:03 ws Exp $ */ /* $NetBSD: mkheaders.c,v 1.25 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -52,23 +52,23 @@
#include <string.h> #include <string.h>
#include "config.h" #include "config.h"
static int emitcnt __P((struct nvlist *)); static int emitcnt(struct nvlist *);
static int emitlocs __P((void)); static int emitlocs(void);
static int emitopts __P((void)); static int emitopts(void);
static int emitioconfh __P((void)); static int emitioconfh(void);
static int herr __P((const char *, const char *, FILE *)); static int herr(const char *, const char *, FILE *);
static int locators_print __P((const char *, void *, void *)); static int locators_print(const char *, void *, void *);
static int defopts_print __P((const char *, void *, void *)); static int defopts_print(const char *, void *, void *);
static char *cntname __P((const char *)); static char *cntname(const char *);
static int cmphdr __P((const char *, const char *)); static int cmphdr(const char *, const char *);
static int fprintcnt __P((FILE *, struct nvlist *)); static int fprintcnt(FILE *, struct nvlist *);
static int fprintstr __P((FILE *, const char *)); static int fprintstr(FILE *, const char *);
/* /*
* Make the various config-generated header files. * Make the various config-generated header files.
*/ */
int int
mkheaders() mkheaders(void)
{ {
struct files *fi; struct files *fi;
@ -91,17 +91,14 @@ mkheaders()
static int static int
fprintcnt(fp, nv) fprintcnt(FILE *fp, struct nvlist *nv)
FILE *fp;
struct nvlist *nv;
{ {
return (fprintf(fp, "#define\t%s\t%d\n", return (fprintf(fp, "#define\t%s\t%d\n",
cntname(nv->nv_name), nv->nv_int)); cntname(nv->nv_name), nv->nv_int));
} }
static int static int
emitcnt(head) emitcnt(struct nvlist *head)
struct nvlist *head;
{ {
char nfname[BUFSIZ], tfname[BUFSIZ]; char nfname[BUFSIZ], tfname[BUFSIZ];
struct nvlist *nv; struct nvlist *nv;
@ -129,9 +126,7 @@ emitcnt(head)
* Otherwise the first backslash in a \? sequence will be dropped. * Otherwise the first backslash in a \? sequence will be dropped.
*/ */
static int static int
fprintstr(fp, str) fprintstr(FILE *fp, const char *str)
FILE *fp;
const char *str;
{ {
int n; int n;
@ -160,9 +155,7 @@ fprintstr(fp, str)
* the options defined for this file. * the options defined for this file.
*/ */
static int static int
defopts_print(name, value, arg) defopts_print(const char *name, void *value, void *arg)
const char *name;
void *value, *arg;
{ {
char tfname[BUFSIZ]; char tfname[BUFSIZ];
struct nvlist *nv, *option; struct nvlist *nv, *option;
@ -213,7 +206,7 @@ defopts_print(name, value, arg)
* Emit the option header files. * Emit the option header files.
*/ */
static int static int
emitopts() emitopts(void)
{ {
return (ht_enumerate(optfiletab, defopts_print, NULL)); return (ht_enumerate(optfiletab, defopts_print, NULL));
@ -225,10 +218,7 @@ emitopts()
* "name" attribute node (passed as the "value" parameter). * "name" attribute node (passed as the "value" parameter).
*/ */
static int static int
locators_print(name, value, arg) locators_print(const char *name, void *value, void *arg)
const char *name;
void *value;
void *arg;
{ {
struct attr *a; struct attr *a;
struct nvlist *nv; struct nvlist *nv;
@ -286,7 +276,7 @@ locators_print(name, value, arg)
* hash table and emitting all the locators for each attribute. * hash table and emitting all the locators for each attribute.
*/ */
static int static int
emitlocs() emitlocs(void)
{ {
char *tfname; char *tfname;
int rval; int rval;
@ -309,7 +299,7 @@ emitlocs()
* cfdrivers. * cfdrivers.
*/ */
static int static int
emitioconfh() emitioconfh(void)
{ {
const char *tfname; const char *tfname;
FILE *tfp; FILE *tfp;
@ -338,8 +328,7 @@ emitioconfh()
* tfname, move tfname to nfname. Otherwise, delete tfname. * tfname, move tfname to nfname. Otherwise, delete tfname.
*/ */
static int static int
cmphdr(tfname, nfname) cmphdr(const char *tfname, const char *nfname)
const char *tfname, *nfname;
{ {
char tbuf[BUFSIZ], nbuf[BUFSIZ]; char tbuf[BUFSIZ], nbuf[BUFSIZ];
FILE *tfp, *nfp; FILE *tfp, *nfp;
@ -392,9 +381,7 @@ cmphdr(tfname, nfname)
} }
static int static int
herr(what, fname, fp) herr(const char *what, const char *fname, FILE *fp)
const char *what, *fname;
FILE *fp;
{ {
extern char *__progname; extern char *__progname;
@ -406,8 +393,7 @@ herr(what, fname, fp)
} }
static char * static char *
cntname(src) cntname(const char *src)
const char *src;
{ {
char *dst, c; char *dst, c;
static char buf[100]; static char buf[100];

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkioconf.c,v 1.52 1999/09/24 04:48:37 enami Exp $ */ /* $NetBSD: mkioconf.c,v 1.53 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -54,18 +54,18 @@
/* /*
* Make ioconf.c. * Make ioconf.c.
*/ */
static int cf_locnames_print __P((const char *, void *, void *)); static int cf_locnames_print(const char *, void *, void *);
static int cforder __P((const void *, const void *)); static int cforder(const void *, const void *);
static int emitcfdata __P((FILE *)); static int emitcfdata(FILE *);
static int emitcfdrivers __P((FILE *)); static int emitcfdrivers(FILE *);
static int emitexterns __P((FILE *)); static int emitexterns(FILE *);
static int emithdr __P((FILE *)); static int emithdr(FILE *);
static int emitloc __P((FILE *)); static int emitloc(FILE *);
static int emitpseudo __P((FILE *)); static int emitpseudo(FILE *);
static int emitpv __P((FILE *)); static int emitpv(FILE *);
static int emitroots __P((FILE *)); static int emitroots(FILE *);
static int emitvfslist __P((FILE *)); static int emitvfslist(FILE *);
static int emitname2blk __P((FILE *)); static int emitname2blk(FILE *);
#define SEP(pos, max) (((u_int)(pos) % (max)) == 0 ? "\n\t" : " ") #define SEP(pos, max) (((u_int)(pos) % (max)) == 0 ? "\n\t" : " ")
@ -78,7 +78,7 @@ static int emitname2blk __P((FILE *));
#define NEWLINE if (putc('\n', fp) < 0) return (1) #define NEWLINE if (putc('\n', fp) < 0) return (1)
int int
mkioconf() mkioconf(void)
{ {
FILE *fp; FILE *fp;
int v; int v;
@ -106,8 +106,7 @@ mkioconf()
} }
static int static int
cforder(a, b) cforder(const void *a, const void *b)
const void *a, *b;
{ {
int n1, n2; int n1, n2;
@ -117,8 +116,7 @@ cforder(a, b)
} }
static int static int
emithdr(ofp) emithdr(FILE *ofp)
FILE *ofp;
{ {
FILE *ifp; FILE *ifp;
int n, rv; int n, rv;
@ -162,8 +160,7 @@ emithdr(ofp)
} }
static int static int
emitcfdrivers(fp) emitcfdrivers(FILE *fp)
FILE *fp;
{ {
struct devbase *d; struct devbase *d;
@ -185,8 +182,7 @@ emitcfdrivers(fp)
} }
static int static int
emitexterns(fp) emitexterns(FILE *fp)
FILE *fp;
{ {
struct deva *da; struct deva *da;
@ -207,10 +203,7 @@ emitexterns(fp)
* attribute's locators. * attribute's locators.
*/ */
static int static int
cf_locnames_print(name, value, arg) cf_locnames_print(const char *name, void *value, void *arg)
const char *name;
void *value;
void *arg;
{ {
struct attr *a; struct attr *a;
struct nvlist *nv; struct nvlist *nv;
@ -230,8 +223,7 @@ cf_locnames_print(name, value, arg)
} }
static int static int
emitloc(fp) emitloc(FILE *fp)
FILE *fp;
{ {
int i; int i;
@ -251,8 +243,7 @@ static int loc[%d] = {", locators.used) < 0)
* Emit global parents-vector. * Emit global parents-vector.
*/ */
static int static int
emitpv(fp) emitpv(FILE *fp)
FILE *fp;
{ {
int i; int i;
@ -269,8 +260,7 @@ static short pv[%d] = {", parents.used) < 0)
* Emit the cfdata array. * Emit the cfdata array.
*/ */
static int static int
emitcfdata(fp) emitcfdata(FILE *fp)
FILE *fp;
{ {
struct devi **p, *i, **par; struct devi **p, *i, **par;
int unit, v; int unit, v;
@ -347,8 +337,7 @@ struct cfdata cfdata[] = {\n\
* Emit the table of potential roots. * Emit the table of potential roots.
*/ */
static int static int
emitroots(fp) emitroots(FILE *fp)
FILE *fp;
{ {
struct devi **p, *i; struct devi **p, *i;
@ -373,8 +362,7 @@ emitroots(fp)
* Emit pseudo-device initialization. * Emit pseudo-device initialization.
*/ */
static int static int
emitpseudo(fp) emitpseudo(FILE *fp)
FILE *fp;
{ {
struct devi *i; struct devi *i;
struct devbase *d; struct devbase *d;
@ -400,8 +388,7 @@ emitpseudo(fp)
* Emit the initial VFS list. * Emit the initial VFS list.
*/ */
static int static int
emitvfslist(fp) emitvfslist(FILE *fp)
FILE *fp;
{ {
struct nvlist *nv; struct nvlist *nv;
@ -438,8 +425,7 @@ emitvfslist(fp)
* Emit name to major block number table. * Emit name to major block number table.
*/ */
int int
emitname2blk(fp) emitname2blk(FILE *fp)
FILE *fp;
{ {
struct devbase *dev; struct devbase *dev;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkmakefile.c,v 1.44 2000/02/01 05:13:17 enami Exp $ */ /* $NetBSD: mkmakefile.c,v 1.45 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -57,26 +57,26 @@
* Make the Makefile. * Make the Makefile.
*/ */
static const char *srcpath __P((struct files *)); static const char *srcpath(struct files *);
static const char *prefix_prologue __P((const char *)); static const char *prefix_prologue(const char *);
static int emitdefs __P((FILE *)); static int emitdefs(FILE *);
static int emitfiles __P((FILE *, int)); static int emitfiles(FILE *, int);
static int emitobjs __P((FILE *)); static int emitobjs(FILE *);
static int emitcfiles __P((FILE *)); static int emitcfiles(FILE *);
static int emitsfiles __P((FILE *)); static int emitsfiles(FILE *);
static int emitrules __P((FILE *)); static int emitrules(FILE *);
static int emitload __P((FILE *)); static int emitload(FILE *);
static int emitincludes __P((FILE *)); static int emitincludes(FILE *);
int int
mkmakefile() mkmakefile(void)
{ {
FILE *ifp, *ofp; FILE *ifp, *ofp;
int lineno; int lineno;
int (*fn) __P((FILE *)); int (*fn)(FILE *);
char *ifname; char *ifname;
char line[BUFSIZ], buf[200]; char line[BUFSIZ], buf[200];
@ -158,8 +158,7 @@ bad:
* get the .o from the obj-directory. * get the .o from the obj-directory.
*/ */
static const char * static const char *
srcpath(fi) srcpath(struct files *fi)
struct files *fi;
{ {
#if 1 #if 1
/* Always have source, don't support object dirs for kernel builds. */ /* Always have source, don't support object dirs for kernel builds. */
@ -179,8 +178,7 @@ srcpath(fi)
} }
static const char * static const char *
prefix_prologue(path) prefix_prologue(const char *path)
const char *path;
{ {
if (*path == '/') if (*path == '/')
@ -190,8 +188,7 @@ prefix_prologue(path)
} }
static int static int
emitdefs(fp) emitdefs(FILE *fp)
FILE *fp;
{ {
struct nvlist *nv; struct nvlist *nv;
char *sp; char *sp;
@ -233,8 +230,7 @@ emitdefs(fp)
} }
static int static int
emitobjs(fp) emitobjs(FILE *fp)
FILE *fp;
{ {
struct files *fi; struct files *fi;
struct objects *oi; struct objects *oi;
@ -297,25 +293,21 @@ emitobjs(fp)
} }
static int static int
emitcfiles(fp) emitcfiles(FILE *fp)
FILE *fp;
{ {
return (emitfiles(fp, 'c')); return (emitfiles(fp, 'c'));
} }
static int static int
emitsfiles(fp) emitsfiles(FILE *fp)
FILE *fp;
{ {
return (emitfiles(fp, 's')); return (emitfiles(fp, 's'));
} }
static int static int
emitfiles(fp, suffix) emitfiles(FILE *fp, int suffix)
FILE *fp;
int suffix;
{ {
struct files *fi; struct files *fi;
struct config *cf; struct config *cf;
@ -393,8 +385,7 @@ emitfiles(fp, suffix)
* Emit the make-rules. * Emit the make-rules.
*/ */
static int static int
emitrules(fp) emitrules(FILE *fp)
FILE *fp;
{ {
struct files *fi; struct files *fi;
const char *cp, *fpath; const char *cp, *fpath;
@ -441,8 +432,7 @@ emitrules(fp)
* This function is not to be called `spurt'. * This function is not to be called `spurt'.
*/ */
static int static int
emitload(fp) emitload(FILE *fp)
FILE *fp;
{ {
struct config *cf; struct config *cf;
const char *nm, *swname; const char *nm, *swname;
@ -487,8 +477,7 @@ swap%s.o: ", swname, swname) < 0)
* Emit include headers (for any prefixes encountered) * Emit include headers (for any prefixes encountered)
*/ */
static int static int
emitincludes(fp) emitincludes(FILE *fp)
FILE *fp;
{ {
struct prefix *pf; struct prefix *pf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkswap.c,v 1.9 1997/10/18 07:59:30 lukem Exp $ */ /* $NetBSD: mkswap.c,v 1.10 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -52,14 +52,14 @@
#include "config.h" #include "config.h"
#include "sem.h" #include "sem.h"
static char *mkdevstr __P((dev_t)); static char *mkdevstr(dev_t);
static int mkoneswap __P((struct config *)); static int mkoneswap(struct config *);
/* /*
* Make the various swap*.c files. Nothing to do for generic swap. * Make the various swap*.c files. Nothing to do for generic swap.
*/ */
int int
mkswap() mkswap(void)
{ {
struct config *cf; struct config *cf;
@ -70,8 +70,7 @@ mkswap()
} }
static char * static char *
mkdevstr(d) mkdevstr(dev_t d)
dev_t d;
{ {
static char buf[32]; static char buf[32];
@ -83,8 +82,7 @@ mkdevstr(d)
} }
static int static int
mkoneswap(cf) mkoneswap(struct config *cf)
struct config *cf;
{ {
struct nvlist *nv; struct nvlist *nv;
FILE *fp; FILE *fp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pack.c,v 1.8 1999/12/20 17:19:13 nathanw Exp $ */ /* $NetBSD: pack.c,v 1.9 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -87,7 +87,7 @@
* (So it goes.) * (So it goes.)
*/ */
typedef int (*vec_cmp_func) __P((const void *, int, int)); typedef int (*vec_cmp_func)(const void *, int, int);
#define TAILHSIZE 128 #define TAILHSIZE 128
#define PVHASH(i) ((i) & (TAILHSIZE - 1)) #define PVHASH(i) ((i) & (TAILHSIZE - 1))
@ -102,24 +102,24 @@ static int locspace;
static int pvecspace; static int pvecspace;
static int longest_pvec; static int longest_pvec;
static void packdevi __P((void)); static void packdevi(void);
static void packlocs __P((void)); static void packlocs(void);
static void packpvec __P((void)); static void packpvec(void);
static void addparents __P((struct devi *src, struct devi *dst)); static void addparents(struct devi *src, struct devi *dst);
static int nparents __P((struct devi **, struct devbase *, int)); static int nparents(struct devi **, struct devbase *, int);
static int sameas __P((struct devi *, struct devi *)); static int sameas(struct devi *, struct devi *);
static int findvec __P((const void *, int, int, vec_cmp_func, int)); static int findvec(const void *, int, int, vec_cmp_func, int);
static int samelocs __P((const void *, int, int)); static int samelocs(const void *, int, int);
static int addlocs __P((const char **, int)); static int addlocs(const char **, int);
static int loclencmp __P((const void *, const void *)); static int loclencmp(const void *, const void *);
static int samepv __P((const void *, int, int)); static int samepv(const void *, int, int);
static int addpv __P((short *, int)); static int addpv(short *, int);
static int pvlencmp __P((const void *, const void *)); static int pvlencmp(const void *, const void *);
static void resettails __P((void)); static void resettails(void);
void void
pack() pack(void)
{ {
struct devi *i; struct devi *i;
int n; int n;
@ -162,7 +162,7 @@ pack()
* if any, of the parents will collapse during packing. * if any, of the parents will collapse during packing.
*/ */
void void
packdevi() packdevi(void)
{ {
struct devi *firststar, *i, **ip, *l, *p; struct devi *firststar, *i, **ip, *l, *p;
struct devbase *d; struct devbase *d;
@ -245,8 +245,7 @@ packdevi()
* have the same locators. * have the same locators.
*/ */
static int static int
sameas(i1, i2) sameas(struct devi *i1, struct devi *i2)
struct devi *i1, *i2;
{ {
const char **p1, **p2; const char **p1, **p2;
@ -265,8 +264,7 @@ sameas(i1, i2)
* instance "dst". * instance "dst".
*/ */
static void static void
addparents(src, dst) addparents(struct devi *src, struct devi *dst)
struct devi *src, *dst;
{ {
struct nvlist *nv; struct nvlist *nv;
struct devi *i, **p, **q; struct devi *i, **p, **q;
@ -330,10 +328,7 @@ addparents(src, dst)
* Count up parents, and optionally store pointers to each. * Count up parents, and optionally store pointers to each.
*/ */
static int static int
nparents(p, dev, unit) nparents(struct devi **p, struct devbase *dev, int unit)
struct devi **p;
struct devbase *dev;
int unit;
{ {
struct devi *i, *l; struct devi *i, *l;
int n; int n;
@ -355,7 +350,7 @@ nparents(p, dev, unit)
} }
static void static void
packlocs() packlocs(void)
{ {
struct devi **p, *i; struct devi **p, *i;
int l, o; int l, o;
@ -373,7 +368,7 @@ packlocs()
} }
static void static void
packpvec() packpvec(void)
{ {
struct devi **p, *i, **par; struct devi **p, *i, **par;
int l, v, o; int l, v, o;
@ -404,11 +399,7 @@ if (l > longest_pvec) panic("packpvec");
* sure that next time, we will find it there. * sure that next time, we will find it there.
*/ */
static int static int
findvec(ptr, hash, len, cmp, nextplace) findvec(const void *ptr, int hash, int len, vec_cmp_func cmp, int nextplace)
const void *ptr;
int hash, len;
vec_cmp_func cmp;
int nextplace;
{ {
struct tails *t, **hp; struct tails *t, **hp;
int off; int off;
@ -430,10 +421,7 @@ findvec(ptr, hash, len, cmp, nextplace)
* Comparison function for locators. * Comparison function for locators.
*/ */
static int static int
samelocs(ptr, off, len) samelocs(const void *ptr, int off, int len)
const void *ptr;
int off;
int len;
{ {
const char **p, **q; const char **p, **q;
@ -447,9 +435,7 @@ samelocs(ptr, off, len)
* Add the given locators at the end of the global loc[] table. * Add the given locators at the end of the global loc[] table.
*/ */
static int static int
addlocs(locs, len) addlocs(const char **locs, int len)
const char **locs;
int len;
{ {
const char **p; const char **p;
int ret; int ret;
@ -467,8 +453,7 @@ addlocs(locs, len)
* We rashly assume that subtraction of these lengths does not overflow. * We rashly assume that subtraction of these lengths does not overflow.
*/ */
static int static int
loclencmp(a, b) loclencmp(const void *a, const void *b)
const void *a, *b;
{ {
int l1, l2; int l1, l2;
@ -481,10 +466,7 @@ loclencmp(a, b)
* Comparison function for parent vectors. * Comparison function for parent vectors.
*/ */
static int static int
samepv(ptr, off, len) samepv(const void *ptr, int off, int len)
const void *ptr;
int off;
int len;
{ {
short *p, *q; short *p, *q;
@ -498,9 +480,7 @@ samepv(ptr, off, len)
* Add the given parent vectors at the end of the global pv[] table. * Add the given parent vectors at the end of the global pv[] table.
*/ */
static int static int
addpv(pv, len) addpv(short *pv, int len)
short *pv;
int len;
{ {
short *p; short *p;
int ret; int ret;
@ -531,8 +511,7 @@ addpv(pv, len)
* We rashly assume that subtraction of these lengths does not overflow. * We rashly assume that subtraction of these lengths does not overflow.
*/ */
static int static int
pvlencmp(a, b) pvlencmp(const void *a, const void *b)
const void *a, *b;
{ {
int l1, l2; int l1, l2;
@ -542,7 +521,7 @@ pvlencmp(a, b)
} }
static void static void
resettails() resettails(void)
{ {
struct tails **p, *t, *next; struct tails **p, *t, *next;
int i; int i;

View File

@ -1,5 +1,5 @@
%{ %{
/* $NetBSD: scan.l,v 1.27 2000/01/23 23:37:42 hubertf Exp $ */ /* $NetBSD: scan.l,v 1.28 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -69,7 +69,7 @@ struct incl {
int in_ateof; /* token to insert at EOF */ int in_ateof; /* token to insert at EOF */
}; };
static struct incl *incl; static struct incl *incl;
static int endinclude __P((void)); static int endinclude(void);
#define yywrap() 1 #define yywrap() 1
@ -186,8 +186,7 @@ with return WITH;
* Open the "main" file (conffile). * Open the "main" file (conffile).
*/ */
int int
firstfile(fname) firstfile(const char *fname)
const char *fname;
{ {
if ((yyin = fopen(fname, "r")) == NULL) if ((yyin = fopen(fname, "r")) == NULL)
@ -205,9 +204,7 @@ firstfile(fname)
* If ateof == 0 then nothing is inserted. * If ateof == 0 then nothing is inserted.
*/ */
int int
include(fname, ateof, conditional) include(const char *fname, int ateof, int conditional)
const char *fname;
int ateof, conditional;
{ {
FILE *fp; FILE *fp;
struct incl *in; struct incl *in;
@ -249,7 +246,7 @@ include(fname, ateof, conditional)
* Terminate the most recent inclusion. * Terminate the most recent inclusion.
*/ */
static int static int
endinclude() endinclude(void)
{ {
struct incl *in; struct incl *in;
int ateof; int ateof;
@ -275,7 +272,7 @@ endinclude()
* token lookahead, so we can tell. * token lookahead, so we can tell.
*/ */
int int
currentline() currentline(void)
{ {
extern int yychar; extern int yychar;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sem.c,v 1.26 2000/05/09 00:34:58 hubertf Exp $ */ /* $NetBSD: sem.c,v 1.27 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -74,22 +74,22 @@ static struct config **nextcf;
static struct devi **nextdevi; static struct devi **nextdevi;
static struct devi **nextpseudo; static struct devi **nextpseudo;
static int has_errobj __P((struct nvlist *, void *)); static int has_errobj(struct nvlist *, void *);
static struct nvlist *addtoattr __P((struct nvlist *, struct devbase *)); static struct nvlist *addtoattr(struct nvlist *, struct devbase *);
static int resolve __P((struct nvlist **, const char *, const char *, static int resolve(struct nvlist **, const char *, const char *,
struct nvlist *, int)); struct nvlist *, int);
static struct devi *newdevi __P((const char *, int, struct devbase *d)); static struct devi *newdevi(const char *, int, struct devbase *d);
static struct devi *getdevi __P((const char *)); static struct devi *getdevi(const char *);
static const char *concat __P((const char *, int)); static const char *concat(const char *, int);
static char *extend __P((char *, const char *)); static char *extend(char *, const char *);
static int split __P((const char *, size_t, char *, size_t, int *)); static int split(const char *, size_t, char *, size_t, int *);
static void selectbase __P((struct devbase *, struct deva *)); static void selectbase(struct devbase *, struct deva *);
static int onlist __P((struct nvlist *, void *)); static int onlist(struct nvlist *, void *);
static const char **fixloc __P((const char *, struct attr *, struct nvlist *)); static const char **fixloc(const char *, struct attr *, struct nvlist *);
static const char *makedevstr __P((int, int)); static const char *makedevstr(int, int);
void void
initsem() initsem(void)
{ {
attrtab = ht_new(); attrtab = ht_new();
@ -122,7 +122,7 @@ initsem()
extern const char *lastfile; extern const char *lastfile;
void void
enddefs() enddefs(void)
{ {
struct devbase *dev; struct devbase *dev;
@ -142,8 +142,7 @@ enddefs()
} }
void void
setdefmaxusers(min, def, max) setdefmaxusers(int min, int def, int max)
int min, def, max;
{ {
if (min < 1 || min > def || def > max) if (min < 1 || min > def || def > max)
@ -156,8 +155,7 @@ setdefmaxusers(min, def, max)
} }
void void
setmaxusers(n) setmaxusers(int n)
int n;
{ {
if (maxusers != 0) { if (maxusers != 0) {
@ -176,8 +174,7 @@ setmaxusers(n)
} }
void void
setident(i) setident(const char *i)
const char *i;
{ {
ident = intern(i); ident = intern(i);
@ -189,10 +186,7 @@ setident(i)
* all locator lists include a dummy head node, which we discard here. * all locator lists include a dummy head node, which we discard here.
*/ */
int int
defattr(name, locs, devclass) defattr(const char *name, struct nvlist *locs, int devclass)
const char *name;
struct nvlist *locs;
int devclass;
{ {
struct attr *a; struct attr *a;
struct nvlist *nv; struct nvlist *nv;
@ -250,9 +244,7 @@ defattr(name, locs, devclass)
* pointer list. * pointer list.
*/ */
static int static int
has_errobj(nv, obj) has_errobj(struct nvlist *nv, void *obj)
struct nvlist *nv;
void *obj;
{ {
for (; nv != NULL; nv = nv->nv_next) for (; nv != NULL; nv = nv->nv_next)
@ -266,9 +258,7 @@ has_errobj(nv, obj)
* pointer list. * pointer list.
*/ */
int int
has_attr(nv, attr) has_attr(struct nvlist *nv, const char *attr)
struct nvlist *nv;
const char *attr;
{ {
struct attr *a; struct attr *a;
@ -287,9 +277,7 @@ has_attr(nv, attr)
* list order, but no one cares anyway. * list order, but no one cares anyway.
*/ */
static struct nvlist * static struct nvlist *
addtoattr(l, dev) addtoattr(struct nvlist *l, struct devbase *dev)
struct nvlist *l;
struct devbase *dev;
{ {
struct nvlist *n; struct nvlist *n;
@ -302,10 +290,8 @@ addtoattr(l, dev)
* attribute and/or refer to existing attributes. * attribute and/or refer to existing attributes.
*/ */
void void
defdev(dev, loclist, attrs, ispseudo) defdev(struct devbase *dev, struct nvlist *loclist, struct nvlist *attrs,
struct devbase *dev; int ispseudo)
struct nvlist *loclist, *attrs;
int ispseudo;
{ {
struct nvlist *nv; struct nvlist *nv;
struct attr *a; struct attr *a;
@ -374,8 +360,7 @@ bad:
* i.e., does not end in a digit or contain special characters. * i.e., does not end in a digit or contain special characters.
*/ */
struct devbase * struct devbase *
getdevbase(name) getdevbase(const char *name)
const char *name;
{ {
u_char *p; u_char *p;
struct devbase *dev; struct devbase *dev;
@ -418,10 +403,8 @@ badname:
* There may be a list of (plain) attributes. * There may be a list of (plain) attributes.
*/ */
void void
defdevattach(deva, dev, atlist, attrs) defdevattach(struct deva *deva, struct devbase *dev, struct nvlist *atlist,
struct deva *deva; struct nvlist *attrs)
struct devbase *dev;
struct nvlist *atlist, *attrs;
{ {
struct nvlist *nv; struct nvlist *nv;
struct attr *a; struct attr *a;
@ -509,8 +492,7 @@ bad:
* name, i.e., does not contain digits or special characters. * name, i.e., does not contain digits or special characters.
*/ */
struct deva * struct deva *
getdevattach(name) getdevattach(const char *name)
const char *name;
{ {
u_char *p; u_char *p;
struct deva *deva; struct deva *deva;
@ -551,8 +533,7 @@ badname:
* Look up an attribute. * Look up an attribute.
*/ */
struct attr * struct attr *
getattr(name) getattr(const char *name)
const char *name;
{ {
struct attr *a; struct attr *a;
@ -568,9 +549,7 @@ getattr(name)
* as a root/dumps "on" device in a configuration. * as a root/dumps "on" device in a configuration.
*/ */
void void
setmajor(d, n) setmajor(struct devbase *d, int n)
struct devbase *d;
int n;
{ {
if (d != &errdev && d->d_major != NODEV) if (d != &errdev && d->d_major != NODEV)
@ -584,8 +563,7 @@ setmajor(d, n)
* Make a string description of the device at maj/min. * Make a string description of the device at maj/min.
*/ */
static const char * static const char *
makedevstr(maj, min) makedevstr(int maj, int min)
int maj, min;
{ {
struct devbase *dev; struct devbase *dev;
char buf[32]; char buf[32];
@ -608,11 +586,8 @@ makedevstr(maj, min)
* corresponding name, and map NULL to the default. * corresponding name, and map NULL to the default.
*/ */
static int static int
resolve(nvp, name, what, dflt, part) resolve(struct nvlist **nvp, const char *name, const char *what,
struct nvlist **nvp; struct nvlist *dflt, int part)
const char *name, *what;
struct nvlist *dflt;
int part;
{ {
struct nvlist *nv; struct nvlist *nv;
struct devbase *dev; struct devbase *dev;
@ -704,8 +679,7 @@ resolve(nvp, name, what, dflt, part)
* Add a completed configuration to the list. * Add a completed configuration to the list.
*/ */
void void
addconf(cf0) addconf(struct config *cf0)
struct config *cf0;
{ {
struct config *cf; struct config *cf;
struct nvlist *nv; struct nvlist *nv;
@ -764,10 +738,7 @@ bad:
} }
void void
setconf(npp, what, v) setconf(struct nvlist **npp, const char *what, struct nvlist *v)
struct nvlist **npp;
const char *what;
struct nvlist *v;
{ {
if (*npp != NULL) { if (*npp != NULL) {
@ -778,9 +749,7 @@ setconf(npp, what, v)
} }
void void
setfstype(fstp, v) setfstype(const char **fstp, const char *v)
const char **fstp;
const char *v;
{ {
if (*fstp != NULL) { if (*fstp != NULL) {
@ -797,10 +766,7 @@ setfstype(fstp, v)
} }
static struct devi * static struct devi *
newdevi(name, unit, d) newdevi(const char *name, int unit, struct devbase *d)
const char *name;
int unit;
struct devbase *d;
{ {
struct devi *i; struct devi *i;
@ -829,10 +795,7 @@ newdevi(name, unit, d)
* another device instead) plus unit number. * another device instead) plus unit number.
*/ */
void void
adddev(name, at, loclist, flags) adddev(const char *name, const char *at, struct nvlist *loclist, int flags)
const char *name, *at;
struct nvlist *loclist;
int flags;
{ {
struct devi *i; /* the new instance */ struct devi *i; /* the new instance */
struct attr *attr; /* attribute that allows attach */ struct attr *attr; /* attribute that allows attach */
@ -966,9 +929,7 @@ bad:
} }
void void
addpseudo(name, number) addpseudo(const char *name, int number)
const char *name;
int number;
{ {
struct devbase *d; struct devbase *d;
struct devi *i; struct devi *i;
@ -999,8 +960,7 @@ addpseudo(name, number)
* Define a new instance of a specific device. * Define a new instance of a specific device.
*/ */
static struct devi * static struct devi *
getdevi(name) getdevi(const char *name)
const char *name;
{ {
struct devi *i, *firsti; struct devi *i, *firsti;
struct devbase *d; struct devbase *d;
@ -1039,9 +999,7 @@ getdevi(name)
} }
static const char * static const char *
concat(name, c) concat(const char *name, int c)
const char *name;
int c;
{ {
int len; int len;
char buf[NAMESIZE]; char buf[NAMESIZE];
@ -1058,16 +1016,14 @@ concat(name, c)
} }
const char * const char *
starref(name) starref(const char *name)
const char *name;
{ {
return (concat(name, '*')); return (concat(name, '*'));
} }
const char * const char *
wildref(name) wildref(const char *name)
const char *name;
{ {
return (concat(name, '?')); return (concat(name, '?'));
@ -1079,12 +1035,7 @@ wildref(name)
* the length of the "foo0" part is one of the arguments. * the length of the "foo0" part is one of the arguments.
*/ */
static int static int
split(name, nlen, base, bsize, aunit) split(const char *name, size_t nlen, char *base, size_t bsize, int *aunit)
const char *name;
size_t nlen;
char *base;
size_t bsize;
int *aunit;
{ {
const char *cp; const char *cp;
int c, l; int c, l;
@ -1116,9 +1067,7 @@ split(name, nlen, base, bsize, aunit)
* attributes for "optional foo". * attributes for "optional foo".
*/ */
static void static void
selectbase(d, da) selectbase(struct devbase *d, struct deva *da)
struct devbase *d;
struct deva *da;
{ {
struct attr *a; struct attr *a;
struct nvlist *nv; struct nvlist *nv;
@ -1142,9 +1091,7 @@ selectbase(d, da)
* Is the given pointer on the given list of pointers? * Is the given pointer on the given list of pointers?
*/ */
static int static int
onlist(nv, ptr) onlist(struct nvlist *nv, void *ptr)
struct nvlist *nv;
void *ptr;
{ {
for (; nv != NULL; nv = nv->nv_next) for (; nv != NULL; nv = nv->nv_next)
if (nv->nv_ptr == ptr) if (nv->nv_ptr == ptr)
@ -1153,9 +1100,7 @@ onlist(nv, ptr)
} }
static char * static char *
extend(p, name) extend(char *p, const char *name)
char *p;
const char *name;
{ {
int l; int l;
@ -1172,10 +1117,7 @@ extend(p, name)
* given as "?" and have defaults. Return 0 on success. * given as "?" and have defaults. Return 0 on success.
*/ */
static const char ** static const char **
fixloc(name, attr, got) fixloc(const char *name, struct attr *attr, struct nvlist *got)
const char *name;
struct attr *attr;
struct nvlist *got;
{ {
struct nvlist *m, *n; struct nvlist *m, *n;
int ord; int ord;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sem.h,v 1.12 2000/01/23 23:37:43 hubertf Exp $ */ /* $NetBSD: sem.h,v 1.13 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -44,29 +44,29 @@
* from: @(#)sem.h 8.1 (Berkeley) 6/6/93 * from: @(#)sem.h 8.1 (Berkeley) 6/6/93
*/ */
void enddefs __P((void)); void enddefs(void);
void setdefmaxusers __P((int, int, int)); void setdefmaxusers(int, int, int);
void setmaxusers __P((int)); void setmaxusers(int);
void setident __P((const char *)); void setident(const char *);
int defattr __P((const char *, struct nvlist *, int)); int defattr(const char *, struct nvlist *, int);
void defdev __P((struct devbase *, struct nvlist *, void defdev(struct devbase *, struct nvlist *, struct nvlist *,
struct nvlist *, int)); int);
void defdevattach __P((struct deva *, struct devbase *, void defdevattach(struct deva *, struct devbase *, struct nvlist *,
struct nvlist *, struct nvlist *)); struct nvlist *);
struct devbase *getdevbase __P((const char *name)); struct devbase *getdevbase(const char *name);
struct deva *getdevattach __P((const char *name)); struct deva *getdevattach(const char *name);
struct attr *getattr __P((const char *name)); struct attr *getattr(const char *name);
void setmajor __P((struct devbase *d, int n)); void setmajor(struct devbase *d, int n);
void addconf __P((struct config *)); void addconf(struct config *);
void setconf __P((struct nvlist **, const char *, struct nvlist *)); void setconf(struct nvlist **, const char *, struct nvlist *);
void setfstype __P((const char **, const char *)); void setfstype(const char **, const char *);
void adddev __P((const char *, const char *, struct nvlist *, int)); void adddev(const char *, const char *, struct nvlist *, int);
void addpseudo __P((const char *name, int number)); void addpseudo(const char *name, int number);
const char *ref __P((const char *name)); const char *ref(const char *name);
const char *starref __P((const char *name)); const char *starref(const char *name);
const char *wildref __P((const char *name)); const char *wildref(const char *name);
int has_attr __P((struct nvlist *, const char *)); int has_attr(struct nvlist *, const char *);
extern const char *s_qmark; extern const char *s_qmark;
extern const char *s_none; extern const char *s_none;

View File

@ -1,4 +1,4 @@
/* $NetBSD: strerror.c,v 1.2 1998/01/09 08:09:20 perry Exp $ */ /* $NetBSD: strerror.c,v 1.3 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* strerror() - for those systems that don't have it yet. * strerror() - for those systems that don't have it yet.
@ -10,9 +10,10 @@ extern int sys_nerr;
static char errmsg[80]; static char errmsg[80];
char *strerror(en) char *
int en; strerror(int en)
{ {
if ((0 <= en) && (en < sys_nerr)) if ((0 <= en) && (en < sys_nerr))
return sys_errlist[en]; return sys_errlist[en];

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.12 2000/10/02 18:59:04 cgd Exp $ */ /* $NetBSD: util.c,v 1.13 2000/10/02 19:48:35 cgd Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -52,18 +52,17 @@
#include <sys/types.h> #include <sys/types.h>
#include "config.h" #include "config.h"
static void nomem __P((void)); static void nomem(void);
static void vxerror __P((const char *, int, const char *, va_list)); static void vxerror(const char *, int, const char *, va_list);
static void vxwarn __P((const char *, int, const char *, va_list)); static void vxwarn(const char *, int, const char *, va_list);
static void vxmsg __P((const char *fname, int line, const char *class, static void vxmsg(const char *fname, int line, const char *class,
const char *fmt, va_list)); const char *fmt, va_list);
/* /*
* Malloc, with abort on error. * Malloc, with abort on error.
*/ */
void * void *
emalloc(size) emalloc(size_t size)
size_t size;
{ {
void *p; void *p;
@ -76,9 +75,7 @@ emalloc(size)
* Realloc, with abort on error. * Realloc, with abort on error.
*/ */
void * void *
erealloc(p, size) erealloc(void *p, size_t size)
void *p;
size_t size;
{ {
if ((p = realloc(p, size)) == NULL) if ((p = realloc(p, size)) == NULL)
@ -90,8 +87,7 @@ erealloc(p, size)
* Strdup, with abort on error. * Strdup, with abort on error.
*/ */
char * char *
estrdup(p) estrdup(const char *p)
const char *p;
{ {
char *cp; char *cp;
@ -101,7 +97,7 @@ estrdup(p)
} }
static void static void
nomem() nomem(void)
{ {
(void)fprintf(stderr, "config: out of memory\n"); (void)fprintf(stderr, "config: out of memory\n");
@ -112,8 +108,7 @@ nomem()
* Push a prefix onto the prefix stack. * Push a prefix onto the prefix stack.
*/ */
void void
prefix_push(path) prefix_push(const char *path)
const char *path;
{ {
struct prefix *pf; struct prefix *pf;
char *cp; char *cp;
@ -137,7 +132,7 @@ prefix_push(path)
* Pop a prefix off the prefix stack. * Pop a prefix off the prefix stack.
*/ */
void void
prefix_pop() prefix_pop(void)
{ {
struct prefix *pf; struct prefix *pf;
@ -157,8 +152,7 @@ prefix_pop()
* Prepend the source path to a file name. * Prepend the source path to a file name.
*/ */
char * char *
sourcepath(file) sourcepath(const char *file)
const char *file;
{ {
size_t len; size_t len;
char *cp; char *cp;
@ -187,11 +181,7 @@ sourcepath(file)
static struct nvlist *nvhead; static struct nvlist *nvhead;
struct nvlist * struct nvlist *
newnv(name, str, ptr, i, next) newnv(const char *name, const char *str, void *ptr, int i, struct nvlist *next)
const char *name, *str;
void *ptr;
int i;
struct nvlist *next;
{ {
struct nvlist *nv; struct nvlist *nv;
@ -216,8 +206,7 @@ newnv(name, str, ptr, i, next)
* Free an nvlist structure (just one). * Free an nvlist structure (just one).
*/ */
void void
nvfree(nv) nvfree(struct nvlist *nv)
struct nvlist *nv;
{ {
nv->nv_next = nvhead; nv->nv_next = nvhead;
@ -228,8 +217,7 @@ nvfree(nv)
* Free an nvlist (the whole list). * Free an nvlist (the whole list).
*/ */
void void
nvfreel(nv) nvfreel(struct nvlist *nv)
struct nvlist *nv;
{ {
struct nvlist *next; struct nvlist *next;
@ -253,11 +241,7 @@ warn(const char *fmt, ...)
static void static void
vxwarn(file, line, fmt, ap) vxwarn(const char *file, int line, const char *fmt, va_list ap)
const char *file;
int line;
const char *fmt;
va_list ap;
{ {
vxmsg(file, line, "warning: ", fmt, ap); vxmsg(file, line, "warning: ", fmt, ap);
} }
@ -295,11 +279,7 @@ xerror(const char *file, int line, const char *fmt, ...)
* Internal form of error() and xerror(). * Internal form of error() and xerror().
*/ */
static void static void
vxerror(file, line, fmt, ap) vxerror(const char *file, int line, const char *fmt, va_list ap)
const char *file;
int line;
const char *fmt;
va_list ap;
{ {
vxmsg(file, line, "", fmt, ap); vxmsg(file, line, "", fmt, ap);
errors++; errors++;
@ -326,12 +306,8 @@ panic(const char *fmt, ...)
* Internal form of error() and xerror(). * Internal form of error() and xerror().
*/ */
static void static void
vxmsg(file, line, msgclass, fmt, ap) vxmsg(const char *file, int line, const char *msgclass, const char *fmt,
const char *file; va_list ap)
int line;
const char *msgclass;
const char *fmt;
va_list ap;
{ {
(void)fprintf(stderr, "%s:%d: %s", file, line, msgclass); (void)fprintf(stderr, "%s:%d: %s", file, line, msgclass);