diff options
author | charnier <charnier@FreeBSD.org> | 1997-09-15 06:37:10 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-09-15 06:37:10 +0000 |
commit | b8c46235c5b5fcd433f224674a9be99e69acc8ee (patch) | |
tree | 1007228a0adbd7ca7cc3ddf18308603f1351f20e /usr.sbin/config/mkioconf.c | |
parent | 130c7bee5c488aa3c51a2fbd042f556666891880 (diff) | |
download | FreeBSD-src-b8c46235c5b5fcd433f224674a9be99e69acc8ee.zip FreeBSD-src-b8c46235c5b5fcd433f224674a9be99e69acc8ee.tar.gz |
Use err(3), add usage(). -Wall clean.
Diffstat (limited to 'usr.sbin/config/mkioconf.c')
-rw-r--r-- | usr.sbin/config/mkioconf.c | 93 |
1 files changed, 52 insertions, 41 deletions
diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c index 17c7b75..db67b2d 100644 --- a/usr.sbin/config/mkioconf.c +++ b/usr.sbin/config/mkioconf.c @@ -32,9 +32,14 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)mkioconf.c 8.2 (Berkeley) 1/21/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ +#include <err.h> #include <stdio.h> #include "y.tab.h" #include "config.h" @@ -46,8 +51,18 @@ char *qu(); char *intv(); char *wnum(); void pseudo_ioconf(); +void comp_config __P((FILE *)); +void scbus_devtab __P((FILE *, FILE *, int *)); +void isa_devtab __P((FILE *, char *, int *)); +void isa_biotab __P((FILE *, char *)); +void i386_ioconf __P((void)); +void hp300_ioconf __P((void)); +int hpbadslave __P((struct device *, struct device *)); +void tahoe_ioconf __P((void)); +void vax_ioconf __P((void)); #if MACHINE_VAX +void vax_ioconf() { register struct device *dp, *mp, *np; @@ -55,10 +70,8 @@ vax_ioconf() FILE *fp; fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } + if (fp == 0) + err(1, "%s", path("ioconf.c")); fprintf(fp, "#include <vax/include/pte.h>\n"); fprintf(fp, "#include <sys/param.h>\n"); fprintf(fp, "#include <sys/buf.h>\n"); @@ -291,6 +304,7 @@ vax_ioconf() #endif #if MACHINE_TAHOE +void tahoe_ioconf() { register struct device *dp, *mp, *np; @@ -298,10 +312,8 @@ tahoe_ioconf() FILE *fp; fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } + if (fp == 0) + err(1, "%s", path("ioconf.c")); fprintf(fp, "#include <sys/param.h>\n"); fprintf(fp, "#include <tahoe/include/pte.h>\n"); fprintf(fp, "#include <sys/buf.h>\n"); @@ -465,6 +477,7 @@ tahoe_ioconf() #endif #if MACHINE_HP300 || MACHINE_LUNA68K +void hp300_ioconf() { register struct device *dp, *mp; @@ -472,10 +485,8 @@ hp300_ioconf() FILE *fp; fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } + if (fp == 0) + err(1, "%s", path("ioconf.c")); fprintf(fp, "#include <sys/param.h>\n"); fprintf(fp, "#include <sys/buf.h>\n"); fprintf(fp, "\n"); @@ -500,7 +511,7 @@ hp300_ioconf() for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || - dp->d_type != MASTER && dp->d_type != CONTROLLER) + (dp->d_type != MASTER && dp->d_type != CONTROLLER)) continue; if (mp != TO_NEXUS) { printf("%s%s must be attached to an sc (nexus)\n", @@ -573,20 +584,21 @@ hp300_ioconf() #define ishpibdev(n) (eq(n,"rd") || eq(n,"ct") || eq(n,"mt") || eq(n,"ppi")) #define isscsidev(n) (eq(n,"sd") || eq(n,"st") || eq(n,"ac")) +int hpbadslave(mp, dp) register struct device *dp, *mp; { - if (mp == TO_NEXUS && ishpibdev(dp->d_name) || - mp != TO_NEXUS && eq(mp->d_name, "hpib") && - !ishpibdev(dp->d_name)) { + if ((mp == TO_NEXUS && ishpibdev(dp->d_name)) || + (mp != TO_NEXUS && eq(mp->d_name, "hpib") && + !ishpibdev(dp->d_name))) { printf("%s%s must be attached to an hpib\n", dp->d_name, wnum(dp->d_unit)); return (1); } - if (mp == TO_NEXUS && isscsidev(dp->d_name) || - mp != TO_NEXUS && eq(mp->d_name, "scsi") && - !isscsidev(dp->d_name)) { + if ((mp == TO_NEXUS && isscsidev(dp->d_name)) || + (mp != TO_NEXUS && eq(mp->d_name, "scsi") && + !isscsidev(dp->d_name))) { printf("%s%s must be attached to a scsi\n", dp->d_name, wnum(dp->d_unit)); return (1); @@ -599,20 +611,18 @@ hpbadslave(mp, dp) char *shandler(); char *sirq(); +void i386_ioconf() { - register struct device *dp, *mp, *np; - register int uba_n, slave; + register struct device *dp, *mp; int dev_id; FILE *fp, *fp1; static char *old_d_name; static char old_shandler[32 + 1]; fp = fopen(path("ioconf.c.new"), "w"); - if (fp == 0) { - perror(path("ioconf.c.new")); - exit(1); - } + if (fp == 0) + err(1, "%s", path("ioconf.c.new")); fprintf(fp, "/*\n"); fprintf(fp, " * I/O configuration.\n"); fprintf(fp, " * DO NOT EDIT-- this file is automatically generated.\n"); @@ -623,10 +633,8 @@ i386_ioconf() fprintf(fp, "\n"); fprintf(fp, "#define C (caddr_t)\n"); fp1 = fopen(path("ioconf.h.new"), "w"); - if (fp1 == 0) { - perror(path("ioconf.h.new")); - exit(1); - } + if (fp1 == 0) + err(1, "%s", path("ioconf.h.new")); fprintf(fp1, "/*\n"); fprintf(fp1, " * Extern declarations for I/O configuration.\n"); fprintf(fp1, " * DO NOT EDIT-- this file is automatically generated.\n"); @@ -705,6 +713,7 @@ i386_ioconf() moveifchanged(path("ioconf.h.new"), path("ioconf.h")); } +void isa_biotab(fp, table) FILE *fp; char *table; @@ -737,6 +746,7 @@ isa_biotab(fp, table) * * 4/26/93 rgrimes */ +void isa_devtab(fp, table, dev_idp) FILE *fp; char *table; @@ -769,7 +779,8 @@ isa_devtab(fp, table, dev_idp) fprintf(fp, "0\n};\n"); } -static char *id(int unit) +static char * +id(int unit) { char *s; switch(unit) @@ -839,6 +850,7 @@ is_old_scsi_device(char *name) * All that nice "conflicting SCSI ID checking" is now * lost and should be put back in. */ +void scbus_devtab(fp, fp1, dev_idp) FILE *fp; FILE *fp1; @@ -967,16 +979,15 @@ sirq(num) #endif #if MACHINE_PMAX +void pmax_ioconf() { register struct device *dp, *mp; FILE *fp; fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } + if (fp == 0) + err(1, "%s", path("ioconf.c")); fprintf(fp, "#include <sys/types.h>\n"); fprintf(fp, "#include <sys/time.h>\n"); fprintf(fp, "#include <pmax/dev/device.h>\n\n"); @@ -1022,7 +1033,7 @@ pmax_ioconf() continue; mp = dp->d_conn; if (mp == 0 || - !eq(mp->d_name, "asc") && !eq(mp->d_name, "sii")) { + (!eq(mp->d_name, "asc") && !eq(mp->d_name, "sii"))) { printf("%s%s: devices must be attached to a SCSI (asc or sii) controller\n", dp->d_name, wnum(dp->d_unit)); continue; @@ -1054,6 +1065,7 @@ int have_iop = 0; int have_hb = 0; int have_vme = 0; +void news_ioconf() { register struct device *dp, *mp; @@ -1061,10 +1073,8 @@ news_ioconf() FILE *fp; fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } + if (fp == 0) + err(1, "%s", path("ioconf.c")); fprintf(fp, "#include <sys/param.h>\n"); fprintf(fp, "#include <sys/buf.h>\n"); fprintf(fp, "#include <vm/vm.h>\n"); @@ -1120,8 +1130,8 @@ news_ioconf() continue; } if (dp->d_flags) { - printf("controllers (e.g. %s%d) don't have flags, "); - printf("only devices do\n", + printf( + "controllers (e.g. %s%d) don't have flags, only devices do\n", dp->d_name, dp->d_unit); continue; } @@ -1281,6 +1291,7 @@ pseudo_ioconf(fp) comp_config(fp); } +void comp_config(fp) FILE *fp; { |