WARNSify, deprecate register, remove unused functions

This commit is contained in:
lukem 1997-10-18 07:58:56 +00:00
parent 8f1ba91f0e
commit 73d91b2129
14 changed files with 305 additions and 330 deletions

View File

@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.16 1997/10/18 04:08:08 lukem Exp $
# $NetBSD: Makefile,v 1.17 1997/10/18 07:58:56 lukem Exp $
# from: @(#)Makefile 8.2 (Berkeley) 4/19/94
WARNS?= 0
PROG= config
BINDIR= /usr/sbin
SRCS= files.c gram.y hash.c main.c mkheaders.c mkioconf.c mkmakefile.c \

View File

@ -1,4 +1,4 @@
.\" $NetBSD: config.8,v 1.11 1997/02/05 19:17:28 thorpej Exp $
.\" $NetBSD: config.8,v 1.12 1997/10/18 07:59:00 lukem Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -40,22 +40,21 @@
.Nm config
.Nd build kernel compilation directories
.Sh SYNOPSIS
.Nm config
.Nm
.Op Fl b Ar builddir
.Op Fl s Ar srcdir
.Op Fl p
.Op Ar config-file
.Sh DESCRIPTION
.Pp
.Nm Config
.Nm
creates a kernel build directory from the file
.Ar config-file ,
which describes the system to configure.
.Pp
There are several different ways to run the
.Nm config
.Nm
program. The traditional way is to run
.Nm config
.Nm
from the
.Pa conf
subdirectory of the machine-specific directory of the system source
@ -70,14 +69,14 @@ is one of
and so forth), and to specify as the
.Ar config-file
the name of a file located in that directory.
.Nm config
.Nm
will by default create files in the directory
.Pa ../compile/SYSTEMNAME ,
where
.Pa SYSTEMNAME
is the last path component of
.Ar config-file .
.Nm Config
.Nm
will assume that the top-level kernel source directory is located four
directories above the build directory.
.Pp
@ -85,13 +84,13 @@ Another way is to create the build directory yourself, place the
configuration file in the build directory with the name
.Pa CONFIG ,
and run
.Nm config
.Nm
from within the build directory without specifying a
.Ar config-file .
.Nm Config
.Nm
will then by default create files in the current directory. If you
run
.Nm config
.Nm
this way, you must specify the location of the top-level kernel source
directory using the
.Fl s
@ -100,7 +99,7 @@ option or by using the
directive at the beginning of the system configuration file.
.Pp
Finally, you can specify the build directory for
.Nm config
.Nm
and run it from anywhere. You can specify a build directory with the
.Fl b
option or by using the
@ -114,7 +113,7 @@ If the
option is supplied,
.Pa .PROF
is appended to the default compilation directory name, and
.Nm config
.Nm
acts as if the lines
.Dq Li makeoptions PROF="-pg"
and
@ -144,7 +143,7 @@ and (typically)
.Dq Li options KGDB .
.Pp
The output of
.Nm config
.Nm
consists of a number of files, principally
.Pa ioconf.c ,
a description of I/O devices that may be attached to the system; and a
@ -154,20 +153,20 @@ used by
in building the kernel.
.Pp
After running
.Nm config ,
.Nm "" ,
it is wise to run
.Dq Li make depend
in the directory where the new makefile
was created.
.Nm Config
.Nm
prints a reminder of this when it completes.
.Pp
If
.Nm config
.Nm
stops due to errors, the problems reported should be corrected and
.Nm config
.Nm
should be run again.
.Nm Config
.Nm
attempts to avoid changing the compilation directory
if there are configuration errors,
but this code is not well-tested,
@ -183,7 +182,7 @@ The SYNOPSIS portion of each device in section 4.
.Xr options 4
.Sh HISTORY
The
.Nm config
.Nm
command appeared in
.Bx 4.1 .
It was completely revised in

View File

@ -1,4 +1,4 @@
/* $NetBSD: config.h,v 1.33 1997/10/10 10:27:53 mycroft Exp $ */
/* $NetBSD: config.h,v 1.34 1997/10/18 07:59:03 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -333,6 +333,7 @@ struct { /* loc[] table for config */
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));
@ -373,6 +374,7 @@ void pack __P((void));
/* scan.l */
int currentline __P((void));
int firstfile __P((const char *));
int include __P((const char *, int));
/* sem.c, other than for yacc actions */
@ -389,3 +391,7 @@ struct nvlist *newnv __P((const char *, const char *, void *, int,
struct nvlist *));
void nvfree __P((struct nvlist *));
void nvfreel __P((struct nvlist *));
/* liby */
void yyerror __P((const char *));
int yylex __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: files.c,v 1.8 1997/10/10 10:27:54 mycroft Exp $ */
/* $NetBSD: files.c,v 1.9 1997/10/18 07:59:06 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -86,17 +86,6 @@ initfiles()
nextobject = &allobjects;
}
static void
showprev(pref, fi)
const char *pref;
register struct files *fi;
{
xerror(fi->fi_srcfile, fi->fi_srcline,
"%sfile %s ...", pref, fi->fi_path);
errors--;
}
void
addfile(path, optx, flags, rule)
const char *path;
@ -174,8 +163,6 @@ addobject(path, optx, flags)
int flags;
{
struct objects *oi;
const char *dotp, *tail;
size_t baselen;
/*
* Commit this object to memory. We will decide later whether it
@ -200,8 +187,6 @@ addobject(path, optx, flags)
*nextobject = oi;
nextobject = &oi->oi_next;
return;
bad:
expr_free(optx);
}
/*
@ -213,8 +198,7 @@ bad:
void
checkfiles()
{
register struct files *fi, *last;
register struct nvlist *nv;
struct files *fi, *last;
last = NULL;
for (fi = *unchecked; fi != NULL; last = fi, fi = fi->fi_next)
@ -233,7 +217,7 @@ checkaux(name, context)
const char *name;
void *context;
{
register struct files *fi = context;
struct files *fi = context;
if (ht_lookup(devbasetab, name) == NULL) {
xerror(fi->fi_srcfile, fi->fi_srcline,
@ -253,7 +237,7 @@ checkaux(name, context)
int
fixfiles()
{
register struct files *fi, *ofi;
struct files *fi, *ofi;
struct nvlist *flathead, **flatp;
int err, sel;
@ -313,7 +297,7 @@ fixfiles()
int
fixobjects()
{
register struct objects *oi, *ooi;
struct objects *oi;
struct nvlist *flathead, **flatp;
int err, sel;
@ -348,12 +332,12 @@ fixobjects()
*/
static int
fixcount(name, context)
register const char *name;
const char *name;
void *context;
{
register struct nvlist ***p = context;
register struct devbase *dev;
register struct nvlist *nv;
struct nvlist ***p = context;
struct devbase *dev;
struct nvlist *nv;
dev = ht_lookup(devbasetab, name);
if (dev == NULL) /* cannot occur here; we checked earlier */
@ -374,9 +358,9 @@ fixfsel(name, context)
const char *name;
void *context;
{
register struct nvlist ***p = context;
register struct nvlist *nv;
register int sel;
struct nvlist ***p = context;
struct nvlist *nv;
int sel;
sel = ht_lookup(selecttab, name) != NULL;
nv = newnv(name, NULL, NULL, sel, NULL);
@ -407,9 +391,9 @@ fixsel(name, context)
*/
static int
expr_eval(expr, fn, context)
register struct nvlist *expr;
register int (*fn) __P((const char *, void *));
register void *context;
struct nvlist *expr;
int (*fn) __P((const char *, void *));
void *context;
{
int lhs, rhs;
@ -433,6 +417,7 @@ expr_eval(expr, fn, context)
}
panic("expr_eval %d", expr->nv_int);
/* NOTREACHED */
return (0);
}
/*
@ -440,9 +425,9 @@ expr_eval(expr, fn, context)
*/
static void
expr_free(expr)
register struct nvlist *expr;
struct nvlist *expr;
{
register struct nvlist *rhs;
struct nvlist *rhs;
/* This loop traverses down the RHS of each subexpression. */
for (; expr != NULL; expr = rhs) {
@ -485,7 +470,7 @@ prexpr(expr)
static void
pr0(e)
register struct nvlist *e;
struct nvlist *e;
{
switch (e->nv_int) {

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: gram.y,v 1.18 1997/10/10 10:41:18 mycroft Exp $ */
/* $NetBSD: gram.y,v 1.19 1997/10/18 07:59:10 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -60,8 +60,6 @@
#define stop(s) error(s), exit(1)
int include __P((const char *, int));
void yyerror __P((const char *));
int yylex __P((void));
static struct config conf; /* at most one active at a time */
@ -436,8 +434,8 @@ yyerror(s)
static void
cleanup()
{
register struct nvlist **np;
register int i;
struct nvlist **np;
int i;
for (np = alloc, i = adepth; --i >= 0; np++)
nvfree(*np);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.5 1997/03/14 00:14:12 jtk Exp $ */
/* $NetBSD: hash.c,v 1.6 1997/10/18 07:59:15 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -89,6 +89,12 @@ 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));
/*
* Allocate space that will never be freed.
*/
@ -96,8 +102,8 @@ static void *
poolalloc(size)
size_t size;
{
register char *p;
register size_t alloc;
char *p;
size_t alloc;
static char *pool;
static size_t nleft;
@ -123,11 +129,11 @@ poolalloc(size)
*/
static void
ht_init(ht, sz)
register struct hashtab *ht;
struct hashtab *ht;
size_t sz;
{
register struct hashent **h;
register u_int n;
struct hashent **h;
u_int n;
h = emalloc(sz * sizeof *h);
ht->ht_tab = h;
@ -144,10 +150,10 @@ ht_init(ht, sz)
*/
static void
ht_expand(ht)
register struct hashtab *ht;
struct hashtab *ht;
{
register struct hashent *p, **h, **oldh, *q;
register u_int n, i;
struct hashent *p, **h, **oldh, *q;
u_int n, i;
n = ht->ht_size * 2;
h = emalloc(n * sizeof *h);
@ -177,8 +183,8 @@ newhashent(name, h)
const char *name;
u_int h;
{
register struct hashent *hp;
register char *m;
struct hashent *hp;
char *m;
m = poolalloc(sizeof(*hp) + ALIGNBYTES);
hp = (struct hashent *)ALIGN(m);
@ -193,9 +199,9 @@ newhashent(name, h)
*/
static inline u_int
hash(str)
register const char *str;
const char *str;
{
register u_int h;
u_int h;
for (h = 0; *str;)
h = (h << 5) + h + *str++;
@ -215,13 +221,13 @@ initintern()
*/
const char *
intern(s)
register const char *s;
const char *s;
{
register struct hashtab *ht;
register struct hashent *hp, **hpp;
register u_int h;
register char *p;
register size_t l;
struct hashtab *ht;
struct hashent *hp, **hpp;
u_int h;
char *p;
size_t l;
ht = &strings;
h = hash(s);
@ -231,7 +237,7 @@ intern(s)
return (hp->h_name);
l = strlen(s) + 1;
p = poolalloc(l);
bcopy(s, p, l);
memmove(p, s, l);
*hpp = newhashent(p, h);
if (++ht->ht_used > ht->ht_lim)
ht_expand(ht);
@ -241,7 +247,7 @@ intern(s)
struct hashtab *
ht_new()
{
register struct hashtab *ht;
struct hashtab *ht;
ht = emalloc(sizeof *ht);
ht_init(ht, 8);
@ -253,13 +259,13 @@ ht_new()
*/
int
ht_insrep(ht, nam, val, replace)
register struct hashtab *ht;
register const char *nam;
struct hashtab *ht;
const char *nam;
void *val;
int replace;
{
register struct hashent *hp, **hpp;
register u_int h;
struct hashent *hp, **hpp;
u_int h;
h = hash(nam);
hpp = &ht->ht_tab[h & ht->ht_mask];
@ -279,11 +285,11 @@ ht_insrep(ht, nam, val, replace)
void *
ht_lookup(ht, nam)
register struct hashtab *ht;
register const char *nam;
struct hashtab *ht;
const char *nam;
{
register struct hashent *hp, **hpp;
register u_int h;
struct hashent *hp, **hpp;
u_int h;
h = hash(nam);
hpp = &ht->ht_tab[h & ht->ht_mask];
@ -306,7 +312,7 @@ ht_enumerate(ht, cbfunc, arg)
void *arg;
{
struct hashent *hp, **hpp;
register u_int i;
u_int i;
int rval = 0;
for (i = 0; i < ht->ht_size; i++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.26 1997/10/18 04:08:12 lukem Exp $ */
/* $NetBSD: main.c,v 1.27 1997/10/18 07:59:18 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,9 +45,11 @@
*/
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#ifndef MAKE_BOOTSTRAP
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n");
#endif /* not MAKE_BOOTSTRAP */
#endif /* not lint */
#include <sys/types.h>
@ -75,21 +77,23 @@ static struct nvlist **nextdefopt;
static struct nvlist **nextmkopt;
static struct nvlist **nextfsopt;
static __dead 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));
static int mksymlinks __P((void));
static int hasparent __P((struct devi *));
static int cfcrosscheck __P((struct config *, const char *, 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 hasparent __P((struct devi *));
static int cfcrosscheck __P((struct config *, const char *,
struct nvlist *));
int
main(argc, argv)
int argc;
char **argv;
{
register char *p;
char *p;
const char *last_component;
int pflag, ch;
@ -302,8 +306,8 @@ void
defoption(name)
const char *name;
{
register const char *n;
register char *p, c;
const char *n;
char *p, c;
char low[500];
/*
@ -335,8 +339,8 @@ void
addoption(name, value)
const char *name, *value;
{
register const char *n;
register char *p, c;
const char *n;
char *p, c;
char low[500];
if (do_option(opttab, &nextopt, name, value, "options"))
@ -359,9 +363,8 @@ void
addfsoption(name)
const char *name;
{
register struct nvlist *nv;
register const char *n;
register char *p, c;
const char *n;
char *p, c;
char buf[500];
/* Convert to lowercase. */
@ -404,7 +407,7 @@ do_option(ht, nppp, name, value, type)
struct nvlist ***nppp;
const char *name, *value, *type;
{
register struct nvlist *nv;
struct nvlist *nv;
/* assume it will work */
nv = newnv(name, value, NULL, 0, NULL);
@ -431,10 +434,10 @@ do_option(ht, nppp, name, value, type)
*/
int
deva_has_instances(deva, unit)
register struct deva *deva;
struct deva *deva;
int unit;
{
register struct devi *i;
struct devi *i;
if (unit == WILD)
return (deva->d_ihead != NULL);
@ -450,10 +453,10 @@ deva_has_instances(deva, unit)
*/
int
devbase_has_instances(dev, unit)
register struct devbase *dev;
struct devbase *dev;
int unit;
{
register struct deva *da;
struct deva *da;
for (da = dev->d_ahead; da != NULL; da = da->d_bsame)
if (deva_has_instances(da, unit))
@ -463,9 +466,9 @@ devbase_has_instances(dev, unit)
static int
hasparent(i)
register struct devi *i;
struct devi *i;
{
register struct nvlist *nv;
struct nvlist *nv;
int atunit = i->i_atunit;
/*
@ -498,12 +501,12 @@ hasparent(i)
static int
cfcrosscheck(cf, what, nv)
register struct config *cf;
struct config *cf;
const char *what;
register struct nvlist *nv;
struct nvlist *nv;
{
register struct devbase *dev;
register struct devi *pd;
struct devbase *dev;
struct devi *pd;
int errs, devunit;
if (maxpartitions <= 0)
@ -546,8 +549,8 @@ loop:
int
crosscheck()
{
register struct devi *i;
register struct config *cf;
struct devi *i;
struct config *cf;
int errs;
errs = 0;
@ -581,10 +584,10 @@ crosscheck()
int
badstar()
{
register struct devbase *d;
register struct deva *da;
register struct devi *i;
register int errs, n;
struct devbase *d;
struct deva *da;
struct devi *i;
int errs, n;
errs = 0;
for (d = allbases; d != NULL; d = d->d_next) {
@ -619,7 +622,6 @@ void
setupdirs()
{
struct stat st;
char *prof;
/* srcdir must be specified if builddir is not specified or if
* no configuration filename was specified. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkheaders.c,v 1.15 1997/07/18 11:27:37 jtk Exp $ */
/* $NetBSD: mkheaders.c,v 1.16 1997/10/18 07:59:21 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -66,8 +66,8 @@ static char *cntname __P((const char *));
int
mkheaders()
{
register struct files *fi;
register struct nvlist *nv;
struct files *fi;
struct nvlist *nv;
for (fi = allfiles; fi != NULL; fi = fi->fi_next) {
if (fi->fi_flags & FI_HIDDEN)
@ -89,10 +89,10 @@ mkheaders()
static int
emitcnt(head)
register struct nvlist *head;
struct nvlist *head;
{
register struct nvlist *nv;
register FILE *fp;
struct nvlist *nv;
FILE *fp;
int cnt;
char nam[100];
char buf[BUFSIZ];
@ -137,8 +137,7 @@ emitopt(nv)
{
struct nvlist *option;
char new_contents[BUFSIZ], buf[BUFSIZ];
char fname[BUFSIZ], *p, c;
const char *n;
char fname[BUFSIZ], *p;
int len, nlines;
FILE *fp;
@ -209,10 +208,10 @@ locators_print(name, value, arg)
void *arg;
{
struct attr *a;
register struct nvlist *nv;
register int i;
struct nvlist *nv;
int i;
char *locdup, *namedup;
register char *cp;
char *cp;
FILE *fp = arg;
a = value;
@ -265,11 +264,9 @@ locators_print(name, value, arg)
static int
emitlocs()
{
struct nvlist *option;
char nbuf[BUFSIZ], obuf[BUFSIZ];
char *tfname, *nfname;
const char *n;
int count, rval;
char *tfname, *nfname = NULL;
int rval;
FILE *tfp = NULL, *nfp = NULL;
tfname = "tmp_locators.h";
@ -335,9 +332,9 @@ err(what, fname, fp)
static char *
cntname(src)
register const char *src;
const char *src;
{
register char *dst, c;
char *dst, c;
static char buf[100];
dst = buf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkioconf.c,v 1.43 1997/03/14 22:54:08 jtk Exp $ */
/* $NetBSD: mkioconf.c,v 1.44 1997/10/18 07:59:25 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -63,7 +63,6 @@ static int emitloc __P((FILE *));
static int emitpseudo __P((FILE *));
static int emitpv __P((FILE *));
static int emitroots __P((FILE *));
static char *vecname __P((char *, const char *, int));
#define SEP(pos, max) (((u_int)(pos) % (max)) == 0 ? "\n\t" : " ")
@ -76,7 +75,7 @@ static char *vecname __P((char *, const char *, int));
int
mkioconf()
{
register FILE *fp;
FILE *fp;
int v;
qsort(packed, npacked, sizeof *packed, cforder);
@ -104,7 +103,7 @@ static int
cforder(a, b)
const void *a, *b;
{
register int n1, n2;
int n1, n2;
n1 = (*(struct devi **)a)->i_cfindex;
n2 = (*(struct devi **)b)->i_cfindex;
@ -113,10 +112,10 @@ cforder(a, b)
static int
emithdr(ofp)
register FILE *ofp;
FILE *ofp;
{
register FILE *ifp;
register int n;
FILE *ifp;
int n;
char ifn[200], buf[BUFSIZ];
if (fprintf(ofp, "\
@ -149,10 +148,10 @@ emithdr(ofp)
static int
emitexterns(fp)
register FILE *fp;
FILE *fp;
{
register struct devbase *d;
register struct deva *da;
struct devbase *d;
struct deva *da;
NEWLINE;
for (d = allbases; d != NULL; d = d->d_next) {
@ -185,7 +184,7 @@ cf_locnames_print(name, value, arg)
void *arg;
{
struct attr *a;
register struct nvlist *nv;
struct nvlist *nv;
FILE *fp = arg;
a = value;
@ -204,9 +203,9 @@ cf_locnames_print(name, value, arg)
static int
emitloc(fp)
register FILE *fp;
FILE *fp;
{
register int i;
int i;
if (fprintf(fp, "\n/* locators */\n\
static int loc[%d] = {", locators.used) < 0)
@ -225,9 +224,9 @@ static int loc[%d] = {", locators.used) < 0)
*/
static int
emitpv(fp)
register FILE *fp;
FILE *fp;
{
register int i;
int i;
if (fprintf(fp, "\n/* parent vectors */\n\
static short pv[%d] = {", parents.used) < 0)
@ -243,13 +242,13 @@ static short pv[%d] = {", parents.used) < 0)
*/
static int
emitcfdata(fp)
register FILE *fp;
FILE *fp;
{
register struct devi **p, *i, **par;
register int unit, v;
register const char *state, *basename, *attachment;
register struct nvlist *nv;
register struct attr *a;
struct devi **p, *i, **par;
int unit, v;
const char *state, *basename, *attachment;
struct nvlist *nv;
struct attr *a;
char *loc;
char locbuf[20];
@ -313,9 +312,9 @@ struct cfdata cfdata[] = {\n\
*/
static int
emitroots(fp)
register FILE *fp;
FILE *fp;
{
register struct devi **p, *i;
struct devi **p, *i;
if (fputs("\nshort cfroots[] = {\n", fp) < 0)
return (1);
@ -339,10 +338,10 @@ emitroots(fp)
*/
static int
emitpseudo(fp)
register FILE *fp;
FILE *fp;
{
register struct devi *i;
register struct devbase *d;
struct devi *i;
struct devbase *d;
if (fputs("\n/* pseudo-devices */\n", fp) < 0)
return (1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkmakefile.c,v 1.35 1997/10/10 10:27:58 mycroft Exp $ */
/* $NetBSD: mkmakefile.c,v 1.36 1997/10/18 07:59:28 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -71,10 +71,10 @@ static int emitload __P((FILE *));
int
mkmakefile()
{
register FILE *ifp, *ofp;
register int lineno;
register int (*fn) __P((FILE *));
register char *ifname;
FILE *ifp, *ofp;
int lineno;
int (*fn) __P((FILE *));
char *ifname;
char line[BUFSIZ], buf[200];
(void)sprintf(buf, "arch/%s/conf/Makefile.%s", machine, machine);
@ -154,7 +154,7 @@ bad:
*/
static const char *
srcpath(fi)
register struct files *fi;
struct files *fi;
{
#if 1
/* Always have source, don't support object dirs for kernel builds. */
@ -175,10 +175,10 @@ srcpath(fi)
static int
emitdefs(fp)
register FILE *fp;
FILE *fp;
{
register struct nvlist *nv;
register char *sp;
struct nvlist *nv;
char *sp;
if (fputs("IDENT=", fp) < 0)
return (1);
@ -216,11 +216,11 @@ emitdefs(fp)
static int
emitobjs(fp)
register FILE *fp;
FILE *fp;
{
register struct files *fi;
register struct objects *oi;
register int lpos, len, sp;
struct files *fi;
struct objects *oi;
int lpos, len, sp;
if (fputs("OBJS=", fp) < 0)
return (1);
@ -279,13 +279,13 @@ emitsfiles(fp)
static int
emitfiles(fp, suffix)
register FILE *fp;
FILE *fp;
int suffix;
{
register struct files *fi;
register struct config *cf;
register int lpos, len, sp;
register const char *fpath;
struct files *fi;
struct config *cf;
int lpos, len, sp;
const char *fpath;
char swapname[100];
if (fprintf(fp, "%cFILES=", toupper(suffix)) < 0)
@ -345,10 +345,10 @@ emitfiles(fp, suffix)
*/
static int
emitrules(fp)
register FILE *fp;
FILE *fp;
{
register struct files *fi;
register const char *cp, *fpath;
struct files *fi;
const char *cp, *fpath;
int ch;
char buf[200];
@ -381,10 +381,10 @@ emitrules(fp)
*/
static int
emitload(fp)
register FILE *fp;
FILE *fp;
{
register struct config *cf;
register const char *nm, *swname;
struct config *cf;
const char *nm, *swname;
int first;
if (fputs("all:", fp) < 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkswap.c,v 1.8 1997/06/14 04:25:55 thorpej Exp $ */
/* $NetBSD: mkswap.c,v 1.9 1997/10/18 07:59:30 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -52,7 +52,8 @@
#include "config.h"
#include "sem.h"
static int mkoneswap __P((struct config *));
static char *mkdevstr __P((dev_t));
static int mkoneswap __P((struct config *));
/*
* Make the various swap*.c files. Nothing to do for generic swap.
@ -60,7 +61,7 @@ static int mkoneswap __P((struct config *));
int
mkswap()
{
register struct config *cf;
struct config *cf;
for (cf = allcf; cf != NULL; cf = cf->cf_next)
if (mkoneswap(cf))
@ -70,7 +71,7 @@ mkswap()
static char *
mkdevstr(d)
dev_t d;
dev_t d;
{
static char buf[32];
@ -83,10 +84,10 @@ dev_t d;
static int
mkoneswap(cf)
register struct config *cf;
struct config *cf;
{
register struct nvlist *nv;
register FILE *fp;
struct nvlist *nv;
FILE *fp;
char fname[200];
char specinfo[200];

View File

@ -1,4 +1,4 @@
/* $NetBSD: pack.c,v 1.6 1997/04/17 05:01:09 cgd Exp $ */
/* $NetBSD: pack.c,v 1.7 1997/10/18 07:59:32 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -121,8 +121,8 @@ static void resettails __P((void));
void
pack()
{
register struct devi *i;
register int n;
struct devi *i;
int n;
/* Pack instances and make parent vectors. */
packdevi();
@ -246,9 +246,9 @@ packdevi()
*/
static int
sameas(i1, i2)
register struct devi *i1, *i2;
struct devi *i1, *i2;
{
register const char **p1, **p2;
const char **p1, **p2;
if (i1->i_atattr != i2->i_atattr)
return (0);
@ -266,11 +266,11 @@ sameas(i1, i2)
*/
static void
addparents(src, dst)
register struct devi *src, *dst;
struct devi *src, *dst;
{
register struct nvlist *nv;
register struct devi *i, **p, **q;
register int j, n, old, new, ndup;
struct nvlist *nv;
struct devi *i, **p, **q;
int j, n, old, new, ndup;
if (dst->i_collapsed)
panic("addparents() i_collapsed");
@ -331,12 +331,12 @@ addparents(src, dst)
*/
static int
nparents(p, dev, unit)
register struct devi **p;
register struct devbase *dev;
register int unit;
struct devi **p;
struct devbase *dev;
int unit;
{
register struct devi *i, *l;
register int n;
struct devi *i, *l;
int n;
n = 0;
/* for each instance ... */
@ -357,8 +357,8 @@ nparents(p, dev, unit)
static void
packlocs()
{
register struct devi **p, *i;
register int l, o;
struct devi **p, *i;
int l, o;
qsort(packed, npacked, sizeof *packed, loclencmp);
for (p = packed; (i = *p) != NULL; p++) {
@ -375,9 +375,9 @@ packlocs()
static void
packpvec()
{
register struct devi **p, *i, **par;
register int l, v, o;
register short *vec;
struct devi **p, *i, **par;
int l, v, o;
short *vec;
vec = emalloc(longest_pvec * sizeof(*vec));
qsort(packed, npacked, sizeof *packed, pvlencmp);
@ -410,8 +410,8 @@ findvec(ptr, hash, len, cmp, nextplace)
vec_cmp_func cmp;
int nextplace;
{
register struct tails *t, **hp;
register int off;
struct tails *t, **hp;
int off;
hp = &tails[hash];
for (t = *hp; t != NULL; t = t->t_next) {
@ -433,9 +433,9 @@ static int
samelocs(ptr, off, len)
const void *ptr;
int off;
register int len;
int len;
{
register const char **p, **q;
const char **p, **q;
for (p = &locators.vec[off], q = (const char **)ptr; --len >= 0;)
if (*p++ != *q++)
@ -448,11 +448,11 @@ samelocs(ptr, off, len)
*/
static int
addlocs(locs, len)
register const char **locs;
register int len;
const char **locs;
int len;
{
register const char **p;
register int ret;
const char **p;
int ret;
ret = locators.used;
if ((locators.used = ret + len) > locspace)
@ -470,7 +470,7 @@ static int
loclencmp(a, b)
const void *a, *b;
{
register int l1, l2;
int l1, l2;
l1 = (*(struct devi **)a)->i_atattr->a_loclen;
l2 = (*(struct devi **)b)->i_atattr->a_loclen;
@ -484,9 +484,9 @@ static int
samepv(ptr, off, len)
const void *ptr;
int off;
register int len;
int len;
{
register short *p, *q;
short *p, *q;
for (p = &parents.vec[off], q = (short *)ptr; --len >= 0;)
if (*p++ != *q++)
@ -499,11 +499,11 @@ samepv(ptr, off, len)
*/
static int
addpv(pv, len)
register short *pv;
register int len;
short *pv;
int len;
{
register short *p;
register int ret;
short *p;
int ret;
static int firstend = -1;
/*
@ -534,7 +534,7 @@ static int
pvlencmp(a, b)
const void *a, *b;
{
register int l1, l2;
int l1, l2;
l1 = (*(struct devi **)a)->i_pvlen;
l2 = (*(struct devi **)b)->i_pvlen;
@ -544,8 +544,8 @@ pvlencmp(a, b)
static void
resettails()
{
register struct tails **p, *t, *next;
register int i;
struct tails **p, *t, *next;
int i;
for (p = tails, i = TAILHSIZE; --i >= 0; p++) {
for (t = *p; t != NULL; t = next) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sem.c,v 1.17 1997/06/14 04:25:56 thorpej Exp $ */
/* $NetBSD: sem.c,v 1.18 1997/10/18 07:59:35 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -76,12 +76,12 @@ static struct devi **nextpseudo;
static int has_errobj __P((struct nvlist *, void *));
static struct nvlist *addtoattr __P((struct nvlist *, struct devbase *));
static int exclude __P((struct nvlist *, const char *, const char *));
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 *));
@ -124,7 +124,7 @@ extern const char *lastfile;
void
enddefs()
{
register struct devbase *dev;
struct devbase *dev;
for (dev = allbases; dev != NULL; dev = dev->d_next) {
if (!dev->d_isdef) {
@ -185,9 +185,9 @@ defattr(name, locs)
const char *name;
struct nvlist *locs;
{
register struct attr *a;
register struct nvlist *nv;
register int len;
struct attr *a;
struct nvlist *nv;
int len;
a = emalloc(sizeof *a);
if (ht_insert(attrtab, name, a)) {
@ -220,8 +220,8 @@ defattr(name, locs)
*/
static int
has_errobj(nv, obj)
register struct nvlist *nv;
register void *obj;
struct nvlist *nv;
void *obj;
{
for (; nv != NULL; nv = nv->nv_next)
@ -236,10 +236,10 @@ has_errobj(nv, obj)
*/
int
has_attr(nv, attr)
register struct nvlist *nv;
register const char *attr;
struct nvlist *nv;
const char *attr;
{
register struct attr *a;
struct attr *a;
if ((a = getattr(attr)) == NULL)
return (0);
@ -257,10 +257,10 @@ has_attr(nv, attr)
*/
static struct nvlist *
addtoattr(l, dev)
register struct nvlist *l;
register struct devbase *dev;
struct nvlist *l;
struct devbase *dev;
{
register struct nvlist *n;
struct nvlist *n;
n = newnv(NULL, NULL, dev, 0, l);
return (n);
@ -272,12 +272,12 @@ addtoattr(l, dev)
*/
void
defdev(dev, ispseudo, loclist, attrs)
register struct devbase *dev;
struct devbase *dev;
int ispseudo;
struct nvlist *loclist, *attrs;
{
register struct nvlist *nv;
register struct attr *a;
struct nvlist *nv;
struct attr *a;
if (dev == &errdev)
goto bad;
@ -332,8 +332,8 @@ struct devbase *
getdevbase(name)
const char *name;
{
register u_char *p;
register struct devbase *dev;
u_char *p;
struct devbase *dev;
p = (u_char *)name;
if (!isalpha(*p))
@ -374,13 +374,13 @@ badname:
*/
void
defdevattach(deva, dev, atlist, attrs)
register struct deva *deva;
struct deva *deva;
struct devbase *dev;
struct nvlist *atlist, *attrs;
{
register struct nvlist *nv;
register struct attr *a;
register struct deva *da;
struct nvlist *nv;
struct attr *a;
struct deva *da;
if (dev == &errdev)
goto bad;
@ -467,8 +467,8 @@ struct deva *
getdevattach(name)
const char *name;
{
register u_char *p;
register struct deva *deva;
u_char *p;
struct deva *deva;
p = (u_char *)name;
if (!isalpha(*p))
@ -535,21 +535,6 @@ setmajor(d, n)
d->d_major = n;
}
#define ABS(x) ((x) < 0 ? -(x) : (x))
static int
exclude(nv, name, what)
struct nvlist *nv;
const char *name, *what;
{
if (nv != NULL) {
error("%s: wildcarded root must not specify %s", name, what);
return (1);
}
return (0);
}
/*
* Make a string description of the device at maj/min.
*/
@ -579,16 +564,15 @@ makedevstr(maj, min)
*/
static int
resolve(nvp, name, what, dflt, part)
register struct nvlist **nvp;
struct nvlist **nvp;
const char *name, *what;
struct nvlist *dflt;
register int part;
int part;
{
register struct nvlist *nv, *anv;
register struct devbase *dev;
register const char *cp;
register int maj, min, i, l;
register struct attr *a;
struct nvlist *nv;
struct devbase *dev;
const char *cp;
int maj, min, i, l;
int unit;
char buf[NAMESIZE];
@ -676,10 +660,10 @@ resolve(nvp, name, what, dflt, part)
*/
void
addconf(cf0)
register struct config *cf0;
struct config *cf0;
{
register struct config *cf;
register struct nvlist *nv;
struct config *cf;
struct nvlist *nv;
const char *name;
name = cf0->cf_name;
@ -736,7 +720,7 @@ bad:
void
setconf(npp, what, v)
register struct nvlist **npp;
struct nvlist **npp;
const char *what;
struct nvlist *v;
{
@ -773,7 +757,7 @@ newdevi(name, unit, d)
int unit;
struct devbase *d;
{
register struct devi *i;
struct devi *i;
i = emalloc(sizeof *i);
i->i_name = name;
@ -805,12 +789,12 @@ adddev(name, at, loclist, flags)
struct nvlist *loclist;
int flags;
{
register struct devi *i; /* the new instance */
register struct attr *attr; /* attribute that allows attach */
register struct devbase *ib; /* i->i_base */
register struct devbase *ab; /* not NULL => at another dev */
register struct nvlist *nv;
register struct deva *iba; /* devbase attachment used */
struct devi *i; /* the new instance */
struct attr *attr; /* attribute that allows attach */
struct devbase *ib; /* i->i_base */
struct devbase *ab; /* not NULL => at another dev */
struct nvlist *nv;
struct deva *iba; /* devbase attachment used */
const char *cp;
int atunit;
char atbuf[NAMESIZE];
@ -917,7 +901,6 @@ findattachment:
if (!hit)
panic("adddev: can't figure out attachment");
}
ok:
if ((i->i_locs = fixloc(name, attr, loclist)) == NULL)
goto bad;
i->i_at = at;
@ -942,8 +925,8 @@ addpseudo(name, number)
const char *name;
int number;
{
register struct devbase *d;
register struct devi *i;
struct devbase *d;
struct devi *i;
d = ht_lookup(devbasetab, name);
if (d == NULL) {
@ -974,8 +957,8 @@ static struct devi *
getdevi(name)
const char *name;
{
register struct devi *i, *firsti;
register struct devbase *d;
struct devi *i, *firsti;
struct devbase *d;
int unit;
char base[NAMESIZE];
@ -1015,7 +998,7 @@ concat(name, c)
const char *name;
int c;
{
register int len;
int len;
char buf[NAMESIZE];
len = strlen(name);
@ -1023,7 +1006,7 @@ concat(name, c)
error("device name `%s%c' too long", name, c);
len = sizeof(buf) - 2;
}
bcopy(name, buf, len);
memmove(buf, name, len);
buf[len] = c;
buf[len + 1] = 0;
return (intern(buf));
@ -1052,14 +1035,14 @@ wildref(name)
*/
static int
split(name, nlen, base, bsize, aunit)
register const char *name;
const char *name;
size_t nlen;
char *base;
size_t bsize;
int *aunit;
{
register const char *cp;
register int c, l;
const char *cp;
int c, l;
l = nlen;
if (l < 2 || l >= bsize || isdigit(*name))
@ -1078,7 +1061,7 @@ split(name, nlen, base, bsize, aunit)
l--, cp--;
*aunit = atoi(cp);
}
bcopy(name, base, l);
memmove(base, name, l);
base[l] = 0;
return (0);
}
@ -1089,11 +1072,11 @@ split(name, nlen, base, bsize, aunit)
*/
static void
selectbase(d, da)
register struct devbase *d;
register struct deva *da;
struct devbase *d;
struct deva *da;
{
register struct attr *a;
register struct nvlist *nv;
struct attr *a;
struct nvlist *nv;
(void)ht_insert(selecttab, d->d_name, (char *)d->d_name);
for (nv = d->d_attrs; nv != NULL; nv = nv->nv_next) {
@ -1115,8 +1098,8 @@ selectbase(d, da)
*/
static int
onlist(nv, ptr)
register struct nvlist *nv;
register void *ptr;
struct nvlist *nv;
void *ptr;
{
for (; nv != NULL; nv = nv->nv_next)
if (nv->nv_ptr == ptr)
@ -1126,13 +1109,13 @@ onlist(nv, ptr)
static char *
extend(p, name)
register char *p;
char *p;
const char *name;
{
register int l;
int l;
l = strlen(name);
bcopy(name, p, l);
memmove(p, name, l);
p += l;
*p++ = ',';
*p++ = ' ';
@ -1146,12 +1129,12 @@ extend(p, name)
static const char **
fixloc(name, attr, got)
const char *name;
register struct attr *attr;
register struct nvlist *got;
struct attr *attr;
struct nvlist *got;
{
register struct nvlist *m, *n;
register int ord;
register const char **lp;
struct nvlist *m, *n;
int ord;
const char **lp;
int nmissing, nextra, nnodefault;
char *mp, *ep, *ndp;
char missing[1000], extra[1000], nodefault[1000];

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.5 1996/08/31 20:58:29 mycroft Exp $ */
/* $NetBSD: util.c,v 1.6 1997/10/18 07:59:38 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -102,7 +102,7 @@ char *
sourcepath(file)
const char *file;
{
register char *cp;
char *cp;
cp = emalloc(strlen(srcdir) + 1 + strlen(file) + 1);
(void)sprintf(cp, "%s/%s", srcdir, file);
@ -118,7 +118,7 @@ newnv(name, str, ptr, i, next)
int i;
struct nvlist *next;
{
register struct nvlist *nv;
struct nvlist *nv;
if ((nv = nvhead) == NULL)
nv = emalloc(sizeof(*nv));
@ -142,7 +142,7 @@ newnv(name, str, ptr, i, next)
*/
void
nvfree(nv)
register struct nvlist *nv;
struct nvlist *nv;
{
nv->nv_next = nvhead;
@ -154,9 +154,9 @@ nvfree(nv)
*/
void
nvfreel(nv)
register struct nvlist *nv;
struct nvlist *nv;
{
register struct nvlist *next;
struct nvlist *next;
for (; nv != NULL; nv = next) {
next = nv->nv_next;