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
@ -54,9 +54,7 @@
#if !defined(MAKE_BOOTSTRAP) && defined(BSD)
#include <sys/cdefs.h>
#include <paths.h>
#else /* ...BSD */
#define __P(protos) protos /* full-blown ANSI C */
#endif /* ...BSD */
#endif
#include <stdlib.h>
#include <unistd.h>
@ -360,39 +358,39 @@ struct { /* loc[] table for config */
} locators;
/* files.c */
void initfiles __P((void));
void checkfiles __P((void));
int fixfiles __P((void)); /* finalize */
int fixobjects __P((void));
void addfile __P((const char *, struct nvlist *, int, const char *));
void addobject __P((const char *, struct nvlist *, int));
void initfiles(void);
void checkfiles(void);
int fixfiles(void); /* finalize */
int fixobjects(void);
void addfile(const char *, struct nvlist *, int, const char *);
void addobject(const char *, struct nvlist *, int);
/* hash.c */
struct hashtab *ht_new __P((void));
int ht_insrep __P((struct hashtab *, const char *, void *, int));
struct hashtab *ht_new(void);
int ht_insrep(struct hashtab *, const char *, void *, int);
#define ht_insert(ht, nam, val) ht_insrep(ht, nam, val, 0)
#define ht_replace(ht, nam, val) ht_insrep(ht, nam, val, 1)
void *ht_lookup __P((struct hashtab *, const char *));
void initintern __P((void));
const char *intern __P((const char *));
typedef int (*ht_callback) __P((const char *, void *, void *));
int ht_enumerate __P((struct hashtab *, ht_callback, void *));
void *ht_lookup(struct hashtab *, const char *);
void initintern(void);
const char *intern(const char *);
typedef int (*ht_callback)(const char *, void *, void *);
int ht_enumerate(struct hashtab *, ht_callback, void *);
/* main.c */
void addoption __P((const char *name, const char *value));
void addfsoption __P((const char *name));
void addmkoption __P((const char *name, const char *value));
void deffilesystem __P((const char *fname, struct nvlist *fses));
void defoption __P((const char *fname, struct nvlist *opts,
struct nvlist *deps));
void defflag __P((const char *fname, struct nvlist *opts,
struct nvlist *deps));
void defparam __P((const char *fname, struct nvlist *opts,
struct nvlist *deps));
int devbase_has_instances __P((struct devbase *, int));
struct nvlist * find_declared_option __P((const char *name));
int deva_has_instances __P((struct deva *, int));
void setupdirs __P((void));
void addoption(const char *name, const char *value);
void addfsoption(const char *name);
void addmkoption(const char *name, const char *value);
void deffilesystem(const char *fname, struct nvlist *fses);
void defoption(const char *fname, struct nvlist *opts,
struct nvlist *deps);
void defflag(const char *fname, struct nvlist *opts,
struct nvlist *deps);
void defparam(const char *fname, struct nvlist *opts,
struct nvlist *deps);
int devbase_has_instances(struct devbase *, int);
struct nvlist * find_declared_option(const char *name);
int deva_has_instances(struct deva *, int);
void setupdirs(void);
/* tests on option types */
#define OPT_FSOPT(n) (ht_lookup(deffstab, (n)) != NULL)
@ -403,44 +401,43 @@ void setupdirs __P((void));
/* mkheaders.c */
int mkheaders __P((void));
int mkheaders(void);
/* mkioconf.c */
int mkioconf __P((void));
int mkioconf(void);
/* mkmakefile.c */
int mkmakefile __P((void));
int mkmakefile(void);
/* mkswap.c */
int mkswap __P((void));
int mkswap(void);
/* pack.c */
void pack __P((void));
void pack(void);
/* scan.l */
int currentline __P((void));
int firstfile __P((const char *));
int include __P((const char *, int, int));
int currentline(void);
int firstfile(const char *);
int include(const char *, int, int);
/* sem.c, other than for yacc actions */
void initsem __P((void));
void initsem(void);
/* util.c */
void *emalloc __P((size_t));
void *erealloc __P((void *, size_t));
char *estrdup __P((const char *));
void prefix_push __P((const char *));
void prefix_pop __P((void));
char *sourcepath __P((const char *));
void warn __P((const char *, ...)); /* immediate warns */
void error __P((const char *, ...)); /* immediate errs */
void xerror __P((const char *, int, const char *, ...)); /* delayed errs */
__dead void panic __P((const char *, ...));
struct nvlist *newnv __P((const char *, const char *, void *, int,
struct nvlist *));
void nvfree __P((struct nvlist *));
void nvfreel __P((struct nvlist *));
void *emalloc(size_t);
void *erealloc(void *, size_t);
char *estrdup(const char *);
void prefix_push(const char *);
void prefix_pop(void);
char *sourcepath(const char *);
void warn(const char *, ...); /* immediate warns */
void error(const char *, ...); /* immediate errs */
void xerror(const char *, int, const char *, ...); /* delayed errs */
__dead void panic(const char *, ...);
struct nvlist *newnv(const char *, const char *, void *, int, struct nvlist *);
void nvfree(struct nvlist *);
void nvfreel(struct nvlist *);
/* liby */
void yyerror __P((const char *));
int yylex __P((void));
void yyerror(const char *);
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
@ -67,16 +67,16 @@ static struct files **unchecked;
static struct objects **nextobject;
static int checkaux __P((const char *, void *));
static int fixcount __P((const char *, void *));
static int fixfsel __P((const char *, void *));
static int fixsel __P((const char *, void *));
static int expr_eval __P((struct nvlist *,
int (*)(const char *, void *), void *));
static void expr_free __P((struct nvlist *));
static int checkaux(const char *, void *);
static int fixcount(const char *, void *);
static int fixfsel(const char *, void *);
static int fixsel(const char *, void *);
static int expr_eval(struct nvlist *,
int (*)(const char *, void *), void *);
static void expr_free(struct nvlist *);
void
initfiles()
initfiles(void)
{
basetab = ht_new();
@ -87,11 +87,7 @@ initfiles()
}
void
addfile(path, optx, flags, rule)
const char *path;
struct nvlist *optx;
int flags;
const char *rule;
addfile(const char *path, struct nvlist *optx, int flags, const char *rule)
{
struct files *fi;
const char *dotp, *tail;
@ -173,10 +169,7 @@ bad:
}
void
addobject(path, optx, flags)
const char *path;
struct nvlist *optx;
int flags;
addobject(const char *path, struct nvlist *optx, int flags)
{
struct objects *oi;
@ -213,7 +206,7 @@ addobject(path, optx, flags)
* depending on some machine-specific device.)
*/
void
checkfiles()
checkfiles(void)
{
struct files *fi, *last;
@ -230,9 +223,7 @@ checkfiles()
* We are not actually interested in the expression's value.
*/
static int
checkaux(name, context)
const char *name;
void *context;
checkaux(const char *name, void *context)
{
struct files *fi = context;
@ -252,7 +243,7 @@ checkaux(name, context)
* from the selected sources do not collide.
*/
int
fixfiles()
fixfiles(void)
{
struct files *fi, *ofi;
struct nvlist *flathead, **flatp;
@ -312,7 +303,7 @@ fixfiles()
* selection.
*/
int
fixobjects()
fixobjects(void)
{
struct objects *oi;
struct nvlist *flathead, **flatp;
@ -348,9 +339,7 @@ fixobjects()
* are called to eval each atom.
*/
static int
fixcount(name, context)
const char *name;
void *context;
fixcount(const char *name, void *context)
{
struct nvlist ***p = context;
struct devbase *dev;
@ -371,9 +360,7 @@ fixcount(name, context)
* file that will generate a .h with flags. We will need the flat list.
*/
static int
fixfsel(name, context)
const char *name;
void *context;
fixfsel(const char *name, void *context)
{
struct nvlist ***p = context;
struct nvlist *nv;
@ -390,9 +377,7 @@ fixfsel(name, context)
* As for fixfsel above, but we do not need the flat list.
*/
static int
fixsel(name, context)
const char *name;
void *context;
fixsel(const char *name, void *context)
{
return (ht_lookup(selecttab, name) != NULL);
@ -407,10 +392,7 @@ fixsel(name, context)
* our mixing of C's bitwise & boolean here may give surprises).
*/
static int
expr_eval(expr, fn, context)
struct nvlist *expr;
int (*fn) __P((const char *, void *));
void *context;
expr_eval(struct nvlist *expr, int (*fn)(const char *, void *), void *context)
{
int lhs, rhs;
@ -441,8 +423,7 @@ expr_eval(expr, fn, context)
* Free an expression tree.
*/
static void
expr_free(expr)
struct nvlist *expr;
expr_free(struct nvlist *expr)
{
struct nvlist *rhs;
@ -474,8 +455,7 @@ expr_free(expr)
* Print expression tree.
*/
void
prexpr(expr)
struct nvlist *expr;
prexpr(struct nvlist *expr)
{
static void pr0();
@ -486,8 +466,7 @@ prexpr(expr)
}
static void
pr0(e)
struct nvlist *e;
pr0(struct nvlist *e)
{
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
@ -81,14 +81,14 @@ static int adepth;
#define fx_and(e1, e2) new0(NULL, NULL, e1, FX_AND, e2)
#define fx_or(e1, e2) new0(NULL, NULL, e1, FX_OR, e2)
static void cleanup __P((void));
static void setmachine __P((const char *, const char *));
static void check_maxpart __P((void));
static void cleanup(void);
static void setmachine(const char *, const char *);
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_ns __P((const char *, struct nvlist *));
static struct nvlist *mk_nsis(const char *, int, struct nvlist *, int);
static struct nvlist *mk_ns(const char *, struct nvlist *);
%}
@ -480,8 +480,7 @@ flags_opt:
%%
void
yyerror(s)
const char *s;
yyerror(const char *s)
{
error("%s", s);
@ -492,7 +491,7 @@ yyerror(s)
* allocated during parsing the current line.
*/
static void
cleanup()
cleanup(void)
{
struct nvlist **np;
int i;
@ -503,9 +502,7 @@ cleanup()
}
static void
setmachine(mch, mcharch)
const char *mch;
const char *mcharch;
setmachine(const char *mch, const char *mcharch)
{
char buf[MAXPATHLEN];
@ -529,16 +526,16 @@ setmachine(mch, mcharch)
}
static void
check_maxpart()
check_maxpart(void)
{
if (maxpartitions <= 0) {
stop("cannot proceed without maxpartitions specifier");
}
}
static void
app(p, q)
struct nvlist *p, *q;
app(struct nvlist *p, struct nvlist *q)
{
while (p->nv_next)
p = p->nv_next;
@ -546,11 +543,7 @@ app(p, q)
}
static struct nvlist *
mk_nsis(name, count, adefs, opt)
const char *name;
int count;
struct nvlist *adefs;
int opt;
mk_nsis(const char *name, int count, struct nvlist *adefs, int opt)
{
struct nvlist *defs = adefs;
struct nvlist **p;
@ -576,9 +569,7 @@ mk_nsis(name, count, adefs, opt)
static struct nvlist *
mk_ns(name, vals)
const char *name;
struct nvlist *vals;
mk_ns(const char *name, struct nvlist *vals)
{
struct nvlist *p;
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
@ -89,18 +89,17 @@ static struct hashtab strings;
/* round up to next multiple of y, where y is a power of 2 */
#define ROUND(x, y) (((x) + (y) - 1) & ~((y) - 1))
static void *poolalloc __P((size_t));
static void ht_expand __P((struct hashtab *));
static void ht_init __P((struct hashtab *, size_t));
static inline u_int hash __P((const char *));
static inline struct hashent *newhashent __P((const char *, u_int));
static void *poolalloc(size_t);
static void ht_expand(struct hashtab *);
static void ht_init(struct hashtab *, size_t);
static inline u_int hash(const char *);
static inline struct hashent *newhashent(const char *, u_int);
/*
* Allocate space that will never be freed.
*/
static void *
poolalloc(size)
size_t size;
poolalloc(size_t size)
{
char *p;
size_t alloc;
@ -128,9 +127,7 @@ poolalloc(size)
* Initialize a new hash table. The size must be a power of 2.
*/
static void
ht_init(ht, sz)
struct hashtab *ht;
size_t sz;
ht_init(struct hashtab *ht, size_t sz)
{
struct hashent **h;
u_int n;
@ -149,8 +146,7 @@ ht_init(ht, sz)
* Expand an existing hash table.
*/
static void
ht_expand(ht)
struct hashtab *ht;
ht_expand(struct hashtab *ht)
{
struct hashent *p, **h, **oldh, *q;
u_int n, i;
@ -179,9 +175,7 @@ ht_expand(ht)
* Make a new hash entry, setting its h_next to NULL.
*/
static inline struct hashent *
newhashent(name, h)
const char *name;
u_int h;
newhashent(const char *name, u_int h)
{
struct hashent *hp;
char *m;
@ -198,8 +192,7 @@ newhashent(name, h)
* Hash a string.
*/
static inline u_int
hash(str)
const char *str;
hash(const char *str)
{
u_int h;
@ -209,7 +202,7 @@ hash(str)
}
void
initintern()
initintern(void)
{
ht_init(&strings, 128);
@ -220,8 +213,7 @@ initintern()
* function to be used frequently, so it should be fast.
*/
const char *
intern(s)
const char *s;
intern(const char *s)
{
struct hashtab *ht;
struct hashent *hp, **hpp;
@ -245,7 +237,7 @@ intern(s)
}
struct hashtab *
ht_new()
ht_new(void)
{
struct hashtab *ht;
@ -258,11 +250,7 @@ ht_new()
* Insert and/or replace.
*/
int
ht_insrep(ht, nam, val, replace)
struct hashtab *ht;
const char *nam;
void *val;
int replace;
ht_insrep(struct hashtab *ht, const char *nam, void *val, int replace)
{
struct hashent *hp, **hpp;
u_int h;
@ -284,9 +272,7 @@ ht_insrep(ht, nam, val, replace)
}
void *
ht_lookup(ht, nam)
struct hashtab *ht;
const char *nam;
ht_lookup(struct hashtab *ht, const char *nam)
{
struct hashent *hp, **hpp;
u_int h;
@ -306,10 +292,7 @@ ht_lookup(ht, nam)
*/
int
ht_enumerate(ht, cbfunc, arg)
struct hashtab *ht;
ht_callback cbfunc;
void *arg;
ht_enumerate(struct hashtab *ht, ht_callback cbfunc, void *arg)
{
struct hashent *hp, **hpp;
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
@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
int vflag; /* verbose output */
int yyparse __P((void));
int yyparse(void);
extern int yydebug;
@ -75,32 +75,29 @@ static struct nvlist **nextopt;
static struct nvlist **nextmkopt;
static struct nvlist **nextfsopt;
static void dependopts __P((void));
static void do_depend __P((struct nvlist *));
static void stop __P((void));
static int do_option __P((struct hashtab *, struct nvlist ***,
const char *, const char *, const char *));
static int crosscheck __P((void));
static int badstar __P((void));
int main __P((int, char **));
static int mksymlinks __P((void));
static int mkident __P((void));
static int hasparent __P((struct devi *));
static int cfcrosscheck __P((struct config *, const char *,
struct nvlist *));
void defopt __P((struct hashtab *ht, const char *fname,
struct nvlist *opts, struct nvlist *deps));
static void dependopts(void);
static void do_depend(struct nvlist *);
static void stop(void);
static int do_option(struct hashtab *, struct nvlist ***,
const char *, const char *, const char *);
static int crosscheck(void);
static int badstar(void);
int main(int, char **);
static int mksymlinks(void);
static int mkident(void);
static int hasparent(struct devi *);
static int cfcrosscheck(struct config *, const char *, struct nvlist *);
void defopt(struct hashtab *ht, const char *fname,
struct nvlist *opts, struct nvlist *deps);
int badfilename __P((const char *fname));
int badfilename(const char *fname);
#ifdef MAKE_BOOTSTRAP
char *__progname;
#endif
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
char *p;
const char *last_component;
@ -285,7 +282,7 @@ usage:
* Set any options that are implied by other options.
*/
static void
dependopts()
dependopts(void)
{
struct nvlist *nv, *opt;
@ -300,8 +297,7 @@ dependopts()
}
static void
do_depend(nv)
struct nvlist *nv;
do_depend(struct nvlist *nv)
{
struct nvlist *nextnv;
@ -319,7 +315,7 @@ do_depend(nv)
* and for the machine's CPU architecture, so that works as well.
*/
static int
mksymlinks()
mksymlinks(void)
{
int ret;
char *p, buf[MAXPATHLEN];
@ -359,7 +355,7 @@ mksymlinks()
}
static __dead void
stop()
stop(void)
{
(void)fprintf(stderr, "*** Stop.\n");
exit(1);
@ -372,9 +368,7 @@ stop()
* Otherwise, no preprocessor #defines will be generated.
*/
void
deffilesystem(fname, fses)
const char *fname;
struct nvlist *fses;
deffilesystem(const char *fname, struct nvlist *fses)
{
struct nvlist *nv;
@ -420,8 +414,7 @@ deffilesystem(fname, fses)
* Sanity check a file name.
*/
int
badfilename(fname)
const char *fname;
badfilename(const char *fname)
{
const char *n;
@ -446,8 +439,7 @@ badfilename(fname)
* return the option's struct nvlist.
*/
struct nvlist *
find_declared_option(name)
const char *name;
find_declared_option(const char *name)
{
struct nvlist *option = NULL;
@ -469,10 +461,8 @@ find_declared_option(name)
* record the option information in the specified table.
*/
void
defopt(ht, fname, opts, deps)
struct hashtab *ht;
const char *fname;
struct nvlist *opts, *deps;
defopt(struct hashtab *ht, const char *fname, struct nvlist *opts,
struct nvlist *deps)
{
struct nvlist *nv, *nextnv, *oldnv;
const char *name, *n;
@ -551,10 +541,9 @@ defopt(ht, fname, opts, deps)
* an option file for each option.
*/
void
defoption(fname, opts, deps)
const char *fname;
struct nvlist *opts, *deps;
defoption(const char *fname, struct nvlist *opts, struct nvlist *deps)
{
defopt(defopttab, fname, opts, deps);
}
@ -563,10 +552,9 @@ defoption(fname, opts, deps)
* Define an option for which a value is required.
*/
void
defparam(fname, opts, deps)
const char *fname;
struct nvlist *opts, *deps;
defparam(const char *fname, struct nvlist *opts, struct nvlist *deps)
{
defopt(defparamtab, fname, opts, deps);
}
@ -575,10 +563,9 @@ defparam(fname, opts, deps)
* emits a "needs-flag" style output.
*/
void
defflag(fname, opts, deps)
const char *fname;
struct nvlist *opts, *deps;
defflag(const char *fname, struct nvlist *opts, struct nvlist *deps)
{
defopt(defflagtab, fname, opts, deps);
}
@ -588,8 +575,7 @@ defflag(fname, opts, deps)
* are "optional foo".
*/
void
addoption(name, value)
const char *name, *value;
addoption(const char *name, const char *value)
{
const char *n;
char *p, c;
@ -644,8 +630,7 @@ addoption(name, value)
* file system type. The name is then treated like a standard option.
*/
void
addfsoption(name)
const char *name;
addfsoption(const char *name)
{
const char *n;
char *p, c;
@ -685,8 +670,7 @@ addfsoption(name)
* Add a "make" option.
*/
void
addmkoption(name, value)
const char *name, *value;
addmkoption(const char *name, const char *value)
{
(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.
*/
static int
do_option(ht, nppp, name, value, type)
struct hashtab *ht;
struct nvlist ***nppp;
const char *name, *value, *type;
do_option(struct hashtab *ht, struct nvlist ***nppp, const char *name,
const char *value, const char *type)
{
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).
*/
int
deva_has_instances(deva, unit)
struct deva *deva;
int unit;
deva_has_instances(struct deva *deva, int unit)
{
struct devi *i;
@ -754,9 +734,7 @@ deva_has_instances(deva, unit)
* on the given base (or any units, if unit == WILD).
*/
int
devbase_has_instances(dev, unit)
struct devbase *dev;
int unit;
devbase_has_instances(struct devbase *dev, int unit)
{
struct deva *da;
@ -767,8 +745,7 @@ devbase_has_instances(dev, unit)
}
static int
hasparent(i)
struct devi *i;
hasparent(struct devi *i)
{
struct nvlist *nv;
int atunit = i->i_atunit;
@ -802,10 +779,7 @@ hasparent(i)
}
static int
cfcrosscheck(cf, what, nv)
struct config *cf;
const char *what;
struct nvlist *nv;
cfcrosscheck(struct config *cf, const char *what, struct nvlist *nv)
{
struct devbase *dev;
struct devi *pd;
@ -849,7 +823,7 @@ loop:
* see that the root and dump devices for all configurations are there.
*/
int
crosscheck()
crosscheck(void)
{
struct devi *i;
struct config *cf;
@ -884,7 +858,7 @@ crosscheck()
* Check to see if there is a *'d unit with a needs-count file.
*/
int
badstar()
badstar(void)
{
struct devbase *d;
struct deva *da;
@ -921,7 +895,7 @@ badstar()
* This will be called when we see the first include.
*/
void
setupdirs()
setupdirs(void)
{
struct stat st;
@ -965,7 +939,7 @@ setupdirs()
* newvers.sh to pick it up.
*/
int
mkident()
mkident(void)
{
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
@ -52,23 +52,23 @@
#include <string.h>
#include "config.h"
static int emitcnt __P((struct nvlist *));
static int emitlocs __P((void));
static int emitopts __P((void));
static int emitioconfh __P((void));
static int herr __P((const char *, const char *, FILE *));
static int locators_print __P((const char *, void *, void *));
static int defopts_print __P((const char *, void *, void *));
static char *cntname __P((const char *));
static int cmphdr __P((const char *, const char *));
static int fprintcnt __P((FILE *, struct nvlist *));
static int fprintstr __P((FILE *, const char *));
static int emitcnt(struct nvlist *);
static int emitlocs(void);
static int emitopts(void);
static int emitioconfh(void);
static int herr(const char *, const char *, FILE *);
static int locators_print(const char *, void *, void *);
static int defopts_print(const char *, void *, void *);
static char *cntname(const char *);
static int cmphdr(const char *, const char *);
static int fprintcnt(FILE *, struct nvlist *);
static int fprintstr(FILE *, const char *);
/*
* Make the various config-generated header files.
*/
int
mkheaders()
mkheaders(void)
{
struct files *fi;
@ -91,17 +91,14 @@ mkheaders()
static int
fprintcnt(fp, nv)
FILE *fp;
struct nvlist *nv;
fprintcnt(FILE *fp, struct nvlist *nv)
{
return (fprintf(fp, "#define\t%s\t%d\n",
cntname(nv->nv_name), nv->nv_int));
}
static int
emitcnt(head)
struct nvlist *head;
emitcnt(struct nvlist *head)
{
char nfname[BUFSIZ], tfname[BUFSIZ];
struct nvlist *nv;
@ -129,9 +126,7 @@ emitcnt(head)
* Otherwise the first backslash in a \? sequence will be dropped.
*/
static int
fprintstr(fp, str)
FILE *fp;
const char *str;
fprintstr(FILE *fp, const char *str)
{
int n;
@ -160,9 +155,7 @@ fprintstr(fp, str)
* the options defined for this file.
*/
static int
defopts_print(name, value, arg)
const char *name;
void *value, *arg;
defopts_print(const char *name, void *value, void *arg)
{
char tfname[BUFSIZ];
struct nvlist *nv, *option;
@ -213,7 +206,7 @@ defopts_print(name, value, arg)
* Emit the option header files.
*/
static int
emitopts()
emitopts(void)
{
return (ht_enumerate(optfiletab, defopts_print, NULL));
@ -225,10 +218,7 @@ emitopts()
* "name" attribute node (passed as the "value" parameter).
*/
static int
locators_print(name, value, arg)
const char *name;
void *value;
void *arg;
locators_print(const char *name, void *value, void *arg)
{
struct attr *a;
struct nvlist *nv;
@ -286,7 +276,7 @@ locators_print(name, value, arg)
* hash table and emitting all the locators for each attribute.
*/
static int
emitlocs()
emitlocs(void)
{
char *tfname;
int rval;
@ -309,7 +299,7 @@ emitlocs()
* cfdrivers.
*/
static int
emitioconfh()
emitioconfh(void)
{
const char *tfname;
FILE *tfp;
@ -338,8 +328,7 @@ emitioconfh()
* tfname, move tfname to nfname. Otherwise, delete tfname.
*/
static int
cmphdr(tfname, nfname)
const char *tfname, *nfname;
cmphdr(const char *tfname, const char *nfname)
{
char tbuf[BUFSIZ], nbuf[BUFSIZ];
FILE *tfp, *nfp;
@ -392,9 +381,7 @@ cmphdr(tfname, nfname)
}
static int
herr(what, fname, fp)
const char *what, *fname;
FILE *fp;
herr(const char *what, const char *fname, FILE *fp)
{
extern char *__progname;
@ -406,8 +393,7 @@ herr(what, fname, fp)
}
static char *
cntname(src)
const char *src;
cntname(const char *src)
{
char *dst, c;
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
@ -54,18 +54,18 @@
/*
* Make ioconf.c.
*/
static int cf_locnames_print __P((const char *, void *, void *));
static int cforder __P((const void *, const void *));
static int emitcfdata __P((FILE *));
static int emitcfdrivers __P((FILE *));
static int emitexterns __P((FILE *));
static int emithdr __P((FILE *));
static int emitloc __P((FILE *));
static int emitpseudo __P((FILE *));
static int emitpv __P((FILE *));
static int emitroots __P((FILE *));
static int emitvfslist __P((FILE *));
static int emitname2blk __P((FILE *));
static int cf_locnames_print(const char *, void *, void *);
static int cforder(const void *, const void *);
static int emitcfdata(FILE *);
static int emitcfdrivers(FILE *);
static int emitexterns(FILE *);
static int emithdr(FILE *);
static int emitloc(FILE *);
static int emitpseudo(FILE *);
static int emitpv(FILE *);
static int emitroots(FILE *);
static int emitvfslist(FILE *);
static int emitname2blk(FILE *);
#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)
int
mkioconf()
mkioconf(void)
{
FILE *fp;
int v;
@ -106,8 +106,7 @@ mkioconf()
}
static int
cforder(a, b)
const void *a, *b;
cforder(const void *a, const void *b)
{
int n1, n2;
@ -117,8 +116,7 @@ cforder(a, b)
}
static int
emithdr(ofp)
FILE *ofp;
emithdr(FILE *ofp)
{
FILE *ifp;
int n, rv;
@ -162,8 +160,7 @@ emithdr(ofp)
}
static int
emitcfdrivers(fp)
FILE *fp;
emitcfdrivers(FILE *fp)
{
struct devbase *d;
@ -185,8 +182,7 @@ emitcfdrivers(fp)
}
static int
emitexterns(fp)
FILE *fp;
emitexterns(FILE *fp)
{
struct deva *da;
@ -207,10 +203,7 @@ emitexterns(fp)
* attribute's locators.
*/
static int
cf_locnames_print(name, value, arg)
const char *name;
void *value;
void *arg;
cf_locnames_print(const char *name, void *value, void *arg)
{
struct attr *a;
struct nvlist *nv;
@ -230,8 +223,7 @@ cf_locnames_print(name, value, arg)
}
static int
emitloc(fp)
FILE *fp;
emitloc(FILE *fp)
{
int i;
@ -251,8 +243,7 @@ static int loc[%d] = {", locators.used) < 0)
* Emit global parents-vector.
*/
static int
emitpv(fp)
FILE *fp;
emitpv(FILE *fp)
{
int i;
@ -269,8 +260,7 @@ static short pv[%d] = {", parents.used) < 0)
* Emit the cfdata array.
*/
static int
emitcfdata(fp)
FILE *fp;
emitcfdata(FILE *fp)
{
struct devi **p, *i, **par;
int unit, v;
@ -347,8 +337,7 @@ struct cfdata cfdata[] = {\n\
* Emit the table of potential roots.
*/
static int
emitroots(fp)
FILE *fp;
emitroots(FILE *fp)
{
struct devi **p, *i;
@ -373,8 +362,7 @@ emitroots(fp)
* Emit pseudo-device initialization.
*/
static int
emitpseudo(fp)
FILE *fp;
emitpseudo(FILE *fp)
{
struct devi *i;
struct devbase *d;
@ -400,8 +388,7 @@ emitpseudo(fp)
* Emit the initial VFS list.
*/
static int
emitvfslist(fp)
FILE *fp;
emitvfslist(FILE *fp)
{
struct nvlist *nv;
@ -438,8 +425,7 @@ emitvfslist(fp)
* Emit name to major block number table.
*/
int
emitname2blk(fp)
FILE *fp;
emitname2blk(FILE *fp)
{
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
@ -57,26 +57,26 @@
* 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 emitfiles __P((FILE *, int));
static int emitdefs(FILE *);
static int emitfiles(FILE *, int);
static int emitobjs __P((FILE *));
static int emitcfiles __P((FILE *));
static int emitsfiles __P((FILE *));
static int emitrules __P((FILE *));
static int emitload __P((FILE *));
static int emitincludes __P((FILE *));
static int emitobjs(FILE *);
static int emitcfiles(FILE *);
static int emitsfiles(FILE *);
static int emitrules(FILE *);
static int emitload(FILE *);
static int emitincludes(FILE *);
int
mkmakefile()
mkmakefile(void)
{
FILE *ifp, *ofp;
int lineno;
int (*fn) __P((FILE *));
int (*fn)(FILE *);
char *ifname;
char line[BUFSIZ], buf[200];
@ -158,8 +158,7 @@ bad:
* get the .o from the obj-directory.
*/
static const char *
srcpath(fi)
struct files *fi;
srcpath(struct files *fi)
{
#if 1
/* Always have source, don't support object dirs for kernel builds. */
@ -179,8 +178,7 @@ srcpath(fi)
}
static const char *
prefix_prologue(path)
const char *path;
prefix_prologue(const char *path)
{
if (*path == '/')
@ -190,8 +188,7 @@ prefix_prologue(path)
}
static int
emitdefs(fp)
FILE *fp;
emitdefs(FILE *fp)
{
struct nvlist *nv;
char *sp;
@ -233,8 +230,7 @@ emitdefs(fp)
}
static int
emitobjs(fp)
FILE *fp;
emitobjs(FILE *fp)
{
struct files *fi;
struct objects *oi;
@ -297,25 +293,21 @@ emitobjs(fp)
}
static int
emitcfiles(fp)
FILE *fp;
emitcfiles(FILE *fp)
{
return (emitfiles(fp, 'c'));
}
static int
emitsfiles(fp)
FILE *fp;
emitsfiles(FILE *fp)
{
return (emitfiles(fp, 's'));
}
static int
emitfiles(fp, suffix)
FILE *fp;
int suffix;
emitfiles(FILE *fp, int suffix)
{
struct files *fi;
struct config *cf;
@ -393,8 +385,7 @@ emitfiles(fp, suffix)
* Emit the make-rules.
*/
static int
emitrules(fp)
FILE *fp;
emitrules(FILE *fp)
{
struct files *fi;
const char *cp, *fpath;
@ -441,8 +432,7 @@ emitrules(fp)
* This function is not to be called `spurt'.
*/
static int
emitload(fp)
FILE *fp;
emitload(FILE *fp)
{
struct config *cf;
const char *nm, *swname;
@ -487,8 +477,7 @@ swap%s.o: ", swname, swname) < 0)
* Emit include headers (for any prefixes encountered)
*/
static int
emitincludes(fp)
FILE *fp;
emitincludes(FILE *fp)
{
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
@ -52,14 +52,14 @@
#include "config.h"
#include "sem.h"
static char *mkdevstr __P((dev_t));
static int mkoneswap __P((struct config *));
static char *mkdevstr(dev_t);
static int mkoneswap(struct config *);
/*
* Make the various swap*.c files. Nothing to do for generic swap.
*/
int
mkswap()
mkswap(void)
{
struct config *cf;
@ -70,8 +70,7 @@ mkswap()
}
static char *
mkdevstr(d)
dev_t d;
mkdevstr(dev_t d)
{
static char buf[32];
@ -83,8 +82,7 @@ mkdevstr(d)
}
static int
mkoneswap(cf)
struct config *cf;
mkoneswap(struct config *cf)
{
struct nvlist *nv;
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
@ -87,7 +87,7 @@
* (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 PVHASH(i) ((i) & (TAILHSIZE - 1))
@ -102,24 +102,24 @@ static int locspace;
static int pvecspace;
static int longest_pvec;
static void packdevi __P((void));
static void packlocs __P((void));
static void packpvec __P((void));
static void packdevi(void);
static void packlocs(void);
static void packpvec(void);
static void addparents __P((struct devi *src, struct devi *dst));
static int nparents __P((struct devi **, struct devbase *, int));
static int sameas __P((struct devi *, struct devi *));
static int findvec __P((const void *, int, int, vec_cmp_func, int));
static int samelocs __P((const void *, int, int));
static int addlocs __P((const char **, int));
static int loclencmp __P((const void *, const void *));
static int samepv __P((const void *, int, int));
static int addpv __P((short *, int));
static int pvlencmp __P((const void *, const void *));
static void resettails __P((void));
static void addparents(struct devi *src, struct devi *dst);
static int nparents(struct devi **, struct devbase *, int);
static int sameas(struct devi *, struct devi *);
static int findvec(const void *, int, int, vec_cmp_func, int);
static int samelocs(const void *, int, int);
static int addlocs(const char **, int);
static int loclencmp(const void *, const void *);
static int samepv(const void *, int, int);
static int addpv(short *, int);
static int pvlencmp(const void *, const void *);
static void resettails(void);
void
pack()
pack(void)
{
struct devi *i;
int n;
@ -162,7 +162,7 @@ pack()
* if any, of the parents will collapse during packing.
*/
void
packdevi()
packdevi(void)
{
struct devi *firststar, *i, **ip, *l, *p;
struct devbase *d;
@ -245,8 +245,7 @@ packdevi()
* have the same locators.
*/
static int
sameas(i1, i2)
struct devi *i1, *i2;
sameas(struct devi *i1, struct devi *i2)
{
const char **p1, **p2;
@ -265,8 +264,7 @@ sameas(i1, i2)
* instance "dst".
*/
static void
addparents(src, dst)
struct devi *src, *dst;
addparents(struct devi *src, struct devi *dst)
{
struct nvlist *nv;
struct devi *i, **p, **q;
@ -330,10 +328,7 @@ addparents(src, dst)
* Count up parents, and optionally store pointers to each.
*/
static int
nparents(p, dev, unit)
struct devi **p;
struct devbase *dev;
int unit;
nparents(struct devi **p, struct devbase *dev, int unit)
{
struct devi *i, *l;
int n;
@ -355,7 +350,7 @@ nparents(p, dev, unit)
}
static void
packlocs()
packlocs(void)
{
struct devi **p, *i;
int l, o;
@ -373,7 +368,7 @@ packlocs()
}
static void
packpvec()
packpvec(void)
{
struct devi **p, *i, **par;
int l, v, o;
@ -404,11 +399,7 @@ if (l > longest_pvec) panic("packpvec");
* sure that next time, we will find it there.
*/
static int
findvec(ptr, hash, len, cmp, nextplace)
const void *ptr;
int hash, len;
vec_cmp_func cmp;
int nextplace;
findvec(const void *ptr, int hash, int len, vec_cmp_func cmp, int nextplace)
{
struct tails *t, **hp;
int off;
@ -430,10 +421,7 @@ findvec(ptr, hash, len, cmp, nextplace)
* Comparison function for locators.
*/
static int
samelocs(ptr, off, len)
const void *ptr;
int off;
int len;
samelocs(const void *ptr, int off, int len)
{
const char **p, **q;
@ -447,9 +435,7 @@ samelocs(ptr, off, len)
* Add the given locators at the end of the global loc[] table.
*/
static int
addlocs(locs, len)
const char **locs;
int len;
addlocs(const char **locs, int len)
{
const char **p;
int ret;
@ -467,8 +453,7 @@ addlocs(locs, len)
* We rashly assume that subtraction of these lengths does not overflow.
*/
static int
loclencmp(a, b)
const void *a, *b;
loclencmp(const void *a, const void *b)
{
int l1, l2;
@ -481,10 +466,7 @@ loclencmp(a, b)
* Comparison function for parent vectors.
*/
static int
samepv(ptr, off, len)
const void *ptr;
int off;
int len;
samepv(const void *ptr, int off, int len)
{
short *p, *q;
@ -498,9 +480,7 @@ samepv(ptr, off, len)
* Add the given parent vectors at the end of the global pv[] table.
*/
static int
addpv(pv, len)
short *pv;
int len;
addpv(short *pv, int len)
{
short *p;
int ret;
@ -531,8 +511,7 @@ addpv(pv, len)
* We rashly assume that subtraction of these lengths does not overflow.
*/
static int
pvlencmp(a, b)
const void *a, *b;
pvlencmp(const void *a, const void *b)
{
int l1, l2;
@ -542,7 +521,7 @@ pvlencmp(a, b)
}
static void
resettails()
resettails(void)
{
struct tails **p, *t, *next;
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
@ -69,7 +69,7 @@ struct incl {
int in_ateof; /* token to insert at EOF */
};
static struct incl *incl;
static int endinclude __P((void));
static int endinclude(void);
#define yywrap() 1
@ -186,8 +186,7 @@ with return WITH;
* Open the "main" file (conffile).
*/
int
firstfile(fname)
const char *fname;
firstfile(const char *fname)
{
if ((yyin = fopen(fname, "r")) == NULL)
@ -205,9 +204,7 @@ firstfile(fname)
* If ateof == 0 then nothing is inserted.
*/
int
include(fname, ateof, conditional)
const char *fname;
int ateof, conditional;
include(const char *fname, int ateof, int conditional)
{
FILE *fp;
struct incl *in;
@ -249,7 +246,7 @@ include(fname, ateof, conditional)
* Terminate the most recent inclusion.
*/
static int
endinclude()
endinclude(void)
{
struct incl *in;
int ateof;
@ -275,7 +272,7 @@ endinclude()
* token lookahead, so we can tell.
*/
int
currentline()
currentline(void)
{
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
@ -74,22 +74,22 @@ static struct config **nextcf;
static struct devi **nextdevi;
static struct devi **nextpseudo;
static int has_errobj __P((struct nvlist *, void *));
static struct nvlist *addtoattr __P((struct nvlist *, struct devbase *));
static int resolve __P((struct nvlist **, const char *, const char *,
struct nvlist *, int));
static struct devi *newdevi __P((const char *, int, struct devbase *d));
static struct devi *getdevi __P((const char *));
static const char *concat __P((const char *, int));
static char *extend __P((char *, const char *));
static int split __P((const char *, size_t, char *, size_t, int *));
static void selectbase __P((struct devbase *, struct deva *));
static int onlist __P((struct nvlist *, void *));
static const char **fixloc __P((const char *, struct attr *, struct nvlist *));
static const char *makedevstr __P((int, int));
static int has_errobj(struct nvlist *, void *);
static struct nvlist *addtoattr(struct nvlist *, struct devbase *);
static int resolve(struct nvlist **, const char *, const char *,
struct nvlist *, int);
static struct devi *newdevi(const char *, int, struct devbase *d);
static struct devi *getdevi(const char *);
static const char *concat(const char *, int);
static char *extend(char *, const char *);
static int split(const char *, size_t, char *, size_t, int *);
static void selectbase(struct devbase *, struct deva *);
static int onlist(struct nvlist *, void *);
static const char **fixloc(const char *, struct attr *, struct nvlist *);
static const char *makedevstr(int, int);
void
initsem()
initsem(void)
{
attrtab = ht_new();
@ -122,7 +122,7 @@ initsem()
extern const char *lastfile;
void
enddefs()
enddefs(void)
{
struct devbase *dev;
@ -142,8 +142,7 @@ enddefs()
}
void
setdefmaxusers(min, def, max)
int min, def, max;
setdefmaxusers(int min, int def, int max)
{
if (min < 1 || min > def || def > max)
@ -156,8 +155,7 @@ setdefmaxusers(min, def, max)
}
void
setmaxusers(n)
int n;
setmaxusers(int n)
{
if (maxusers != 0) {
@ -176,8 +174,7 @@ setmaxusers(n)
}
void
setident(i)
const char *i;
setident(const char *i)
{
ident = intern(i);
@ -189,10 +186,7 @@ setident(i)
* all locator lists include a dummy head node, which we discard here.
*/
int
defattr(name, locs, devclass)
const char *name;
struct nvlist *locs;
int devclass;
defattr(const char *name, struct nvlist *locs, int devclass)
{
struct attr *a;
struct nvlist *nv;
@ -250,9 +244,7 @@ defattr(name, locs, devclass)
* pointer list.
*/
static int
has_errobj(nv, obj)
struct nvlist *nv;
void *obj;
has_errobj(struct nvlist *nv, void *obj)
{
for (; nv != NULL; nv = nv->nv_next)
@ -266,9 +258,7 @@ has_errobj(nv, obj)
* pointer list.
*/
int
has_attr(nv, attr)
struct nvlist *nv;
const char *attr;
has_attr(struct nvlist *nv, const char *attr)
{
struct attr *a;
@ -287,9 +277,7 @@ has_attr(nv, attr)
* list order, but no one cares anyway.
*/
static struct nvlist *
addtoattr(l, dev)
struct nvlist *l;
struct devbase *dev;
addtoattr(struct nvlist *l, struct devbase *dev)
{
struct nvlist *n;
@ -302,10 +290,8 @@ addtoattr(l, dev)
* attribute and/or refer to existing attributes.
*/
void
defdev(dev, loclist, attrs, ispseudo)
struct devbase *dev;
struct nvlist *loclist, *attrs;
int ispseudo;
defdev(struct devbase *dev, struct nvlist *loclist, struct nvlist *attrs,
int ispseudo)
{
struct nvlist *nv;
struct attr *a;
@ -374,8 +360,7 @@ bad:
* i.e., does not end in a digit or contain special characters.
*/
struct devbase *
getdevbase(name)
const char *name;
getdevbase(const char *name)
{
u_char *p;
struct devbase *dev;
@ -418,10 +403,8 @@ badname:
* There may be a list of (plain) attributes.
*/
void
defdevattach(deva, dev, atlist, attrs)
struct deva *deva;
struct devbase *dev;
struct nvlist *atlist, *attrs;
defdevattach(struct deva *deva, struct devbase *dev, struct nvlist *atlist,
struct nvlist *attrs)
{
struct nvlist *nv;
struct attr *a;
@ -509,8 +492,7 @@ bad:
* name, i.e., does not contain digits or special characters.
*/
struct deva *
getdevattach(name)
const char *name;
getdevattach(const char *name)
{
u_char *p;
struct deva *deva;
@ -551,8 +533,7 @@ badname:
* Look up an attribute.
*/
struct attr *
getattr(name)
const char *name;
getattr(const char *name)
{
struct attr *a;
@ -568,9 +549,7 @@ getattr(name)
* as a root/dumps "on" device in a configuration.
*/
void
setmajor(d, n)
struct devbase *d;
int n;
setmajor(struct devbase *d, int n)
{
if (d != &errdev && d->d_major != NODEV)
@ -584,8 +563,7 @@ setmajor(d, n)
* Make a string description of the device at maj/min.
*/
static const char *
makedevstr(maj, min)
int maj, min;
makedevstr(int maj, int min)
{
struct devbase *dev;
char buf[32];
@ -608,11 +586,8 @@ makedevstr(maj, min)
* corresponding name, and map NULL to the default.
*/
static int
resolve(nvp, name, what, dflt, part)
struct nvlist **nvp;
const char *name, *what;
struct nvlist *dflt;
int part;
resolve(struct nvlist **nvp, const char *name, const char *what,
struct nvlist *dflt, int part)
{
struct nvlist *nv;
struct devbase *dev;
@ -704,8 +679,7 @@ resolve(nvp, name, what, dflt, part)
* Add a completed configuration to the list.
*/
void
addconf(cf0)
struct config *cf0;
addconf(struct config *cf0)
{
struct config *cf;
struct nvlist *nv;
@ -764,10 +738,7 @@ bad:
}
void
setconf(npp, what, v)
struct nvlist **npp;
const char *what;
struct nvlist *v;
setconf(struct nvlist **npp, const char *what, struct nvlist *v)
{
if (*npp != NULL) {
@ -778,9 +749,7 @@ setconf(npp, what, v)
}
void
setfstype(fstp, v)
const char **fstp;
const char *v;
setfstype(const char **fstp, const char *v)
{
if (*fstp != NULL) {
@ -797,10 +766,7 @@ setfstype(fstp, v)
}
static struct devi *
newdevi(name, unit, d)
const char *name;
int unit;
struct devbase *d;
newdevi(const char *name, int unit, struct devbase *d)
{
struct devi *i;
@ -829,10 +795,7 @@ newdevi(name, unit, d)
* another device instead) plus unit number.
*/
void
adddev(name, at, loclist, flags)
const char *name, *at;
struct nvlist *loclist;
int flags;
adddev(const char *name, const char *at, struct nvlist *loclist, int flags)
{
struct devi *i; /* the new instance */
struct attr *attr; /* attribute that allows attach */
@ -966,9 +929,7 @@ bad:
}
void
addpseudo(name, number)
const char *name;
int number;
addpseudo(const char *name, int number)
{
struct devbase *d;
struct devi *i;
@ -999,8 +960,7 @@ addpseudo(name, number)
* Define a new instance of a specific device.
*/
static struct devi *
getdevi(name)
const char *name;
getdevi(const char *name)
{
struct devi *i, *firsti;
struct devbase *d;
@ -1039,9 +999,7 @@ getdevi(name)
}
static const char *
concat(name, c)
const char *name;
int c;
concat(const char *name, int c)
{
int len;
char buf[NAMESIZE];
@ -1058,16 +1016,14 @@ concat(name, c)
}
const char *
starref(name)
const char *name;
starref(const char *name)
{
return (concat(name, '*'));
}
const char *
wildref(name)
const char *name;
wildref(const char *name)
{
return (concat(name, '?'));
@ -1079,12 +1035,7 @@ wildref(name)
* the length of the "foo0" part is one of the arguments.
*/
static int
split(name, nlen, base, bsize, aunit)
const char *name;
size_t nlen;
char *base;
size_t bsize;
int *aunit;
split(const char *name, size_t nlen, char *base, size_t bsize, int *aunit)
{
const char *cp;
int c, l;
@ -1116,9 +1067,7 @@ split(name, nlen, base, bsize, aunit)
* attributes for "optional foo".
*/
static void
selectbase(d, da)
struct devbase *d;
struct deva *da;
selectbase(struct devbase *d, struct deva *da)
{
struct attr *a;
struct nvlist *nv;
@ -1142,9 +1091,7 @@ selectbase(d, da)
* Is the given pointer on the given list of pointers?
*/
static int
onlist(nv, ptr)
struct nvlist *nv;
void *ptr;
onlist(struct nvlist *nv, void *ptr)
{
for (; nv != NULL; nv = nv->nv_next)
if (nv->nv_ptr == ptr)
@ -1153,9 +1100,7 @@ onlist(nv, ptr)
}
static char *
extend(p, name)
char *p;
const char *name;
extend(char *p, const char *name)
{
int l;
@ -1172,10 +1117,7 @@ extend(p, name)
* given as "?" and have defaults. Return 0 on success.
*/
static const char **
fixloc(name, attr, got)
const char *name;
struct attr *attr;
struct nvlist *got;
fixloc(const char *name, struct attr *attr, struct nvlist *got)
{
struct nvlist *m, *n;
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
@ -44,29 +44,29 @@
* from: @(#)sem.h 8.1 (Berkeley) 6/6/93
*/
void enddefs __P((void));
void enddefs(void);
void setdefmaxusers __P((int, int, int));
void setmaxusers __P((int));
void setident __P((const char *));
int defattr __P((const char *, struct nvlist *, int));
void defdev __P((struct devbase *, struct nvlist *,
struct nvlist *, int));
void defdevattach __P((struct deva *, struct devbase *,
struct nvlist *, struct nvlist *));
struct devbase *getdevbase __P((const char *name));
struct deva *getdevattach __P((const char *name));
struct attr *getattr __P((const char *name));
void setmajor __P((struct devbase *d, int n));
void addconf __P((struct config *));
void setconf __P((struct nvlist **, const char *, struct nvlist *));
void setfstype __P((const char **, const char *));
void adddev __P((const char *, const char *, struct nvlist *, int));
void addpseudo __P((const char *name, int number));
const char *ref __P((const char *name));
const char *starref __P((const char *name));
const char *wildref __P((const char *name));
int has_attr __P((struct nvlist *, const char *));
void setdefmaxusers(int, int, int);
void setmaxusers(int);
void setident(const char *);
int defattr(const char *, struct nvlist *, int);
void defdev(struct devbase *, struct nvlist *, struct nvlist *,
int);
void defdevattach(struct deva *, struct devbase *, struct nvlist *,
struct nvlist *);
struct devbase *getdevbase(const char *name);
struct deva *getdevattach(const char *name);
struct attr *getattr(const char *name);
void setmajor(struct devbase *d, int n);
void addconf(struct config *);
void setconf(struct nvlist **, const char *, struct nvlist *);
void setfstype(const char **, const char *);
void adddev(const char *, const char *, struct nvlist *, int);
void addpseudo(const char *name, int number);
const char *ref(const char *name);
const char *starref(const char *name);
const char *wildref(const char *name);
int has_attr(struct nvlist *, const char *);
extern const char *s_qmark;
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.
@ -10,9 +10,10 @@ extern int sys_nerr;
static char errmsg[80];
char *strerror(en)
int en;
char *
strerror(int en)
{
if ((0 <= en) && (en < sys_nerr))
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
@ -52,18 +52,17 @@
#include <sys/types.h>
#include "config.h"
static void nomem __P((void));
static void vxerror __P((const char *, int, const char *, va_list));
static void vxwarn __P((const char *, int, const char *, va_list));
static void vxmsg __P((const char *fname, int line, const char *class,
const char *fmt, va_list));
static void nomem(void);
static void vxerror(const char *, int, const char *, va_list);
static void vxwarn(const char *, int, const char *, va_list);
static void vxmsg(const char *fname, int line, const char *class,
const char *fmt, va_list);
/*
* Malloc, with abort on error.
*/
void *
emalloc(size)
size_t size;
emalloc(size_t size)
{
void *p;
@ -76,9 +75,7 @@ emalloc(size)
* Realloc, with abort on error.
*/
void *
erealloc(p, size)
void *p;
size_t size;
erealloc(void *p, size_t size)
{
if ((p = realloc(p, size)) == NULL)
@ -90,8 +87,7 @@ erealloc(p, size)
* Strdup, with abort on error.
*/
char *
estrdup(p)
const char *p;
estrdup(const char *p)
{
char *cp;
@ -101,7 +97,7 @@ estrdup(p)
}
static void
nomem()
nomem(void)
{
(void)fprintf(stderr, "config: out of memory\n");
@ -112,8 +108,7 @@ nomem()
* Push a prefix onto the prefix stack.
*/
void
prefix_push(path)
const char *path;
prefix_push(const char *path)
{
struct prefix *pf;
char *cp;
@ -137,7 +132,7 @@ prefix_push(path)
* Pop a prefix off the prefix stack.
*/
void
prefix_pop()
prefix_pop(void)
{
struct prefix *pf;
@ -157,8 +152,7 @@ prefix_pop()
* Prepend the source path to a file name.
*/
char *
sourcepath(file)
const char *file;
sourcepath(const char *file)
{
size_t len;
char *cp;
@ -187,11 +181,7 @@ sourcepath(file)
static struct nvlist *nvhead;
struct nvlist *
newnv(name, str, ptr, i, next)
const char *name, *str;
void *ptr;
int i;
struct nvlist *next;
newnv(const char *name, const char *str, void *ptr, int i, struct nvlist *next)
{
struct nvlist *nv;
@ -216,8 +206,7 @@ newnv(name, str, ptr, i, next)
* Free an nvlist structure (just one).
*/
void
nvfree(nv)
struct nvlist *nv;
nvfree(struct nvlist *nv)
{
nv->nv_next = nvhead;
@ -228,8 +217,7 @@ nvfree(nv)
* Free an nvlist (the whole list).
*/
void
nvfreel(nv)
struct nvlist *nv;
nvfreel(struct nvlist *nv)
{
struct nvlist *next;
@ -253,11 +241,7 @@ warn(const char *fmt, ...)
static void
vxwarn(file, line, fmt, ap)
const char *file;
int line;
const char *fmt;
va_list ap;
vxwarn(const char *file, int line, const char *fmt, va_list 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().
*/
static void
vxerror(file, line, fmt, ap)
const char *file;
int line;
const char *fmt;
va_list ap;
vxerror(const char *file, int line, const char *fmt, va_list ap)
{
vxmsg(file, line, "", fmt, ap);
errors++;
@ -326,12 +306,8 @@ panic(const char *fmt, ...)
* Internal form of error() and xerror().
*/
static void
vxmsg(file, line, msgclass, fmt, ap)
const char *file;
int line;
const char *msgclass;
const char *fmt;
va_list ap;
vxmsg(const char *file, int line, const char *msgclass, const char *fmt,
va_list ap)
{
(void)fprintf(stderr, "%s:%d: %s", file, line, msgclass);