Use err(3), add usage(). -Wall clean.

This commit is contained in:
Philippe Charnier 1997-09-15 06:37:10 +00:00
parent f7fdb354ff
commit d58316915f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29451
11 changed files with 265 additions and 197 deletions

View File

@ -42,16 +42,15 @@
.Op Fl gpn
.Ar SYSTEM_NAME
.Sh DESCRIPTION
.Pp
This is the old version of the
.Nm config
.Nm
program.
It understands the old autoconfiguration scheme
used on the HP300, i386, DECstation, and derivative platforms.
The new version of config is used with the
SPARC platform.
Only the version of
.Nm config
.Nm
applicable to the architecture that you are running
will be installed on your machine.
.Pp
@ -62,45 +61,33 @@ which describes
the system to configure.
A second file
tells
.Nm config
.Nm
what files are needed to generate a system and
can be augmented by configuration specific set of files
that give alternate files for a specific machine.
that give alternate files for a specific machine
(see the
.Sx FILES
section below)
section below).
.Pp
Available options and operands:
.Pp
.Bl -tag -width SYSTEM_NAME
.It Fl g
If the
.Fl g
option is supplied,
.Nm config
will configure a system for debugging.
Configure a system for debugging.
.It Fl p
If the
.Fl p
option is supplied,
.Nm config
will configure a system for profiling; for example,
Configure a system for profiling; for example,
.Xr kgmon 8
and
.Xr gprof 1 .
If two or more
.Fl p
options are supplied,
.Nm config
.Nm
will configure a system for high resolution profiling.
.It Fl n
If the
.Fl n
flag is specified,
.Nm config
will not remove the old compile directory (see below).
Do not remove the old compile directory (see below).
.It Ar SYSTEM_NAME
specifies the name of the system configuration file
Specifies the name of the system configuration file
containing device specifications, configuration options
and other system parameters for one system configuration.
.El
@ -116,12 +103,12 @@ will create the directory
as necessary and place all output files there.
If the directory already exists, it will be removed
first unless the
.Pa -n
.Fl n
flag was specified or the environment variable
.Nm NO_CONFIG_CLOBBER
.Ev NO_CONFIG_CLOBBER
is set.
The output of
.Nm config
.Nm
consists of a number of files; for the
.Tn i386 ,
they are:
@ -155,7 +142,7 @@ prints a reminder of this when it completes.
If any other error messages are produced by
.Nm config ,
the problems in the configuration file should be corrected and
.Nm config
.Nm
should be run again.
Attempts to compile a system that had configuration errors
are likely to fail.
@ -165,7 +152,7 @@ entire input file is embedded in the new kernel. This means that
.Xr strings 1
can be used to extract it from a kernel.
.Pp
strings | grep ___ will print just the configure information.
Strings | grep ___ will print just the configure information.
.Sh FILES
.Bl -tag -width /sys/i386/conf/Makefile.i386 -compact
.It Pa /sys/conf/files

View File

@ -117,8 +117,8 @@
#include <sys/diskslice.h>
#include <ctype.h>
#include <stdio.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
struct device cur;
@ -126,6 +126,12 @@ struct device *curp = 0;
#define ns(s) strdup(s)
void init_dev __P((struct device *));
int finddev __P((dev_t));
void deverror __P((char *, char *));
int alreadychecked __P((dev_t, dev_t[], dev_t *));
void verifycomp __P((struct file_list *));
%}
%%
Configuration:
@ -398,7 +404,7 @@ Option:
op->op_next = opt;
op->op_value = 0;
opt = op;
if (s = strchr(op->op_name, '=')) {
if ((s = strchr(op->op_name, '='))) {
/* AARGH!!!! Old-style bogon */
*s = '\0';
op->op_value = ns(s + 1);
@ -652,16 +658,17 @@ Id_list:
%%
void
yyerror(s)
char *s;
{
fprintf(stderr, "config: line %d: %s\n", yyline + 1, s);
warnx("line %d: %s", yyline + 1, s);
}
/*
* add a device to the list of devices
*/
void
newdev(dp)
register struct device *dp;
{
@ -681,6 +688,7 @@ newdev(dp)
/*
* note that a configuration should be made
*/
void
mkconf(sysname)
char *sysname;
{
@ -719,12 +727,12 @@ newflist(ftype)
/*
* Add a swap device to the system's configuration
*/
void
mkswap(system, fl, size, flag)
struct file_list *system, *fl;
int size, flag;
{
register struct file_list **flp;
char name[80];
if (system == 0 || system->f_type != SYSTEMSPEC) {
yyerror("\"swap\" spec precedes \"config\" specification");
@ -757,6 +765,7 @@ mkswap(system, fl, size, flag)
system->f_fn = ns(system->f_needs);
}
void
mkcomp(dp)
register struct device *dp;
{
@ -777,11 +786,11 @@ mkcomp(dp)
compp = flp;
}
void
addcomp(compdev, fl)
struct file_list *compdev, *fl;
{
register struct file_list **flp;
char name[80];
if (compdev == 0 || compdev->f_type != COMPDEVICE) {
yyerror("component spec precedes device specification");
@ -887,6 +896,7 @@ huhcon(dev)
return (dp);
}
void
init_dev(dp)
register struct device *dp;
{
@ -912,6 +922,7 @@ init_dev(dp)
/*
* make certain that this is a reasonable type of thing to connect to a nexus
*/
void
check_nexus(dev, num)
register struct device *dev;
int num;
@ -955,6 +966,7 @@ check_nexus(dev, num)
* Check system specification and apply defaulting
* rules on root, argument, dump, and swap devices.
*/
void
checksystemspec(fl)
register struct file_list *fl;
{
@ -1022,6 +1034,7 @@ checksystemspec(fl)
* Verify all devices specified in the system specification
* are present in the device specifications.
*/
void
verifysystemspecs()
{
register struct file_list *fl;
@ -1059,8 +1072,7 @@ verifyswap(fl, checked, pchecked)
if (alreadychecked(fl->f_swapdev, checked, pchecked))
continue;
if (!finddev(fl->f_swapdev))
fprintf(stderr,
"config: swap device %s not configured", fl->f_fn);
warnx("swap device %s not configured", fl->f_fn);
*pchecked++ = fl->f_swapdev;
}
return (pchecked);
@ -1069,6 +1081,7 @@ verifyswap(fl, checked, pchecked)
/*
* Verify that components of a compound device have themselves been config'ed
*/
void
verifycomp(fl)
register struct file_list *fl;
{
@ -1077,9 +1090,7 @@ verifycomp(fl)
for (fl = fl->f_next; fl; fl = fl->f_next) {
if (fl->f_type != COMPSPEC || finddev(fl->f_compdev))
continue;
fprintf(stderr,
"config: %s: component device %s not configured\n",
dname, fl->f_needs);
warnx("%s: component device %s not configured", dname, fl->f_needs);
}
}
@ -1087,6 +1098,7 @@ verifycomp(fl)
* Has a device already been checked
* for its existence in the configuration?
*/
int
alreadychecked(dev, list, last)
dev_t dev, list[];
register dev_t *last;
@ -1099,12 +1111,11 @@ alreadychecked(dev, list, last)
return (0);
}
void
deverror(systemname, devtype)
char *systemname, *devtype;
{
fprintf(stderr, "config: %s: %s device not configured\n",
systemname, devtype);
warnx("%s: %s device not configured", systemname, devtype);
}
/*
@ -1113,6 +1124,7 @@ deverror(systemname, devtype)
* take into account stuff wildcarded.
*/
/*ARGSUSED*/
int
finddev(dev)
dev_t dev;
{

View File

@ -114,6 +114,12 @@ struct kt {
{ "vector", VECTOR },
{ 0, 0 },
};
int kw_lookup __P((char *));
int octal __P((char *));
int hex __P((char *));
%}
WORD [A-Za-z_][-A-Za-z_]*
%%
@ -192,6 +198,7 @@ WORD [A-Za-z_][-A-Za-z_]*
* string is not a keyword otherwise it returns the keyword number
*/
int
kw_lookup(word)
register char *word;
{
@ -207,6 +214,7 @@ register char *word;
* Number conversion routines
*/
int
octal(str)
char *str;
{
@ -216,6 +224,7 @@ char *str;
return num;
}
int
hex(str)
char *str;
{

View File

@ -32,23 +32,28 @@
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1980, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <stdio.h>
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <sysexits.h>
#include <unistd.h>
#include "y.tab.h"
#include "config.h"
@ -64,17 +69,19 @@ static char *PREFIX;
static int no_config_clobber = FALSE;
int old_config_present;
static void usage __P((void));
void configfile __P((void));
/*
* Config builds a set of files for building a UNIX
* system given a description of the desired system.
*/
int
main(argc, argv)
int argc;
char **argv;
{
extern char *optarg;
extern int optind;
struct stat buf;
int ch;
char *p;
@ -92,33 +99,26 @@ main(argc, argv)
break;
case '?':
default:
goto usage;
usage();
}
argc -= optind;
argv += optind;
if (argc != 1) {
usage: fputs("usage: config [-gpn] sysname\n", stderr);
exit(1);
}
if (argc != 1)
usage();
if (freopen(PREFIX = *argv, "r", stdin) == NULL) {
perror(PREFIX);
exit(2);
}
if (freopen(PREFIX = *argv, "r", stdin) == NULL)
err(2, "%s", PREFIX);
if (getenv("NO_CONFIG_CLOBBER"))
no_config_clobber = TRUE;
p = path((char *)NULL);
if (stat(p, &buf)) {
if (mkdir(p, 0777)) {
perror(p);
exit(2);
}
if (mkdir(p, 0777))
err(2, "%s", p);
}
else if ((buf.st_mode & S_IFMT) != S_IFDIR) {
fprintf(stderr, "config: %s isn't a directory.\n", p);
exit(2);
errx(2, "%s isn't a directory", p);
}
#ifndef NO_CLOBBER_EVER
else if (!no_config_clobber) {
@ -129,14 +129,11 @@ usage: fputs("usage: config [-gpn] sysname\n", stderr);
sprintf(tmp, "rm -rf %s", p);
if (system(tmp)) {
fprintf(stderr, "Failed!\n");
perror(tmp);
exit(2);
err(2, "%s", tmp);
}
fprintf(stderr, "Done.\n");
if (mkdir(p, 0777)) {
perror(p);
exit(2);
}
if (mkdir(p, 0777))
err(2, "%s", p);
}
#endif
else
@ -204,6 +201,13 @@ usage: fputs("usage: config [-gpn] sysname\n", stderr);
exit(0);
}
static void
usage()
{
fprintf(stderr, "usage: config [-gpn] sysname\n");
exit(1);
}
/*
* get_word
* returns EOF on end of file
@ -333,6 +337,7 @@ path(file)
return (cp);
}
void
configfile()
{
FILE *fi, *fo;
@ -340,15 +345,11 @@ configfile()
int i;
fi = fopen(PREFIX,"r");
if(!fi) {
perror(PREFIX);
exit(2);
}
if(!fi)
err(2, "%s", PREFIX);
fo = fopen(p=path("config.c.new"),"w");
if(!fo) {
perror(p);
exit(2);
}
if(!fo)
err(2, "%s", p);
fprintf(fo,"#include \"opt_config.h\"\n");
fprintf(fo,"#ifdef INCLUDE_CONFIG_FILE \n");
fprintf(fo,"static char *config = \"\n");

View File

@ -32,35 +32,45 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)mkglue.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
* Make the bus adaptor interrupt glue files.
*/
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include "config.h"
#include "y.tab.h"
#include <ctype.h>
void vector_devtab __P((FILE *, char *, int *));
void vector __P((void));
void dump_ctrs __P((FILE *));
void dump_intname __P((FILE *, char *, int));
void dump_std __P((FILE *, FILE *));
void dump_vbavec __P((FILE *, char *, int));
void dump_ubavec __P((FILE *, char *, int));
/*
* Create the UNIBUS interrupt vector glue file.
*/
void
ubglue()
{
register FILE *fp, *gp;
register struct device *dp, *mp;
fp = fopen(path("ubglue.s"), "w");
if (fp == 0) {
perror(path("ubglue.s"));
exit(1);
}
if (fp == 0)
err(1, "%s", path("ubglue.s"));
gp = fopen(path("ubvec.s"), "w");
if (gp == 0) {
perror(path("ubvec.s"));
exit(1);
}
if (gp == 0)
err(1, "%s", path("ubvec.s"));
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (mp != 0 && mp != (struct device *)-1 &&
@ -110,6 +120,7 @@ static int cntcnt = 0; /* number of interrupt counters allocated */
/*
* Print a UNIBUS interrupt vector.
*/
void
dump_ubavec(fp, vector, number)
register FILE *fp;
char *vector;
@ -143,21 +154,18 @@ dump_ubavec(fp, vector, number)
/*
* Create the VERSAbus interrupt vector glue file.
*/
void
vbglue()
{
register FILE *fp, *gp;
register struct device *dp, *mp;
fp = fopen(path("vbglue.s"), "w");
if (fp == 0) {
perror(path("vbglue.s"));
exit(1);
}
if (fp == 0)
err(1, "%s", path("vbglue.s"));
gp = fopen(path("vbvec.s"), "w");
if (gp == 0) {
perror(path("vbvec.s"));
exit(1);
}
if (gp == 0)
err(1, "%s", path("vbvec.s"));
for (dp = dtab; dp != 0; dp = dp->d_next) {
struct idlst *id, *id2;
@ -203,6 +211,7 @@ vbglue()
/*
* Print a VERSAbus interrupt vector
*/
void
dump_vbavec(fp, vector, number)
register FILE *fp;
char *vector;
@ -229,6 +238,7 @@ dump_vbavec(fp, vector, number)
* HP9000/300 interrupts are auto-vectored.
* Code is hardwired in locore.s
*/
void
hpglue() {}
static char *vaxinames[] = {
@ -253,6 +263,7 @@ static struct stdintrs {
* reference the associated counters into a separate
* file which is prepended to locore.s.
*/
void
dump_std(fp, gp)
register FILE *fp, *gp;
{
@ -287,6 +298,7 @@ dump_std(fp, gp)
}
}
void
dump_intname(fp, vector, number)
register FILE *fp;
char *vector;
@ -313,6 +325,7 @@ dump_intname(fp, vector, number)
/*
* Reserve space for the interrupt counters.
*/
void
dump_ctrs(fp)
register FILE *fp;
{
@ -341,16 +354,15 @@ dump_ctrs(fp)
* simplify the correspondence between devices and interrupt handlers.
* The order must match that in mkioconf.c.
*/
void
vector()
{
int dev_id;
FILE *fp;
fp = fopen(path("vector.h.new"), "w");
if (fp == NULL) {
perror(path("vector.h.new"));
exit(1);
}
if (fp == NULL)
err(1, "%s", path("vector.h.new"));
fprintf(fp, "/*\n");
fprintf(fp, " * vector.h\n");
fprintf(fp, " * Macros for interrupt vector routines\n");
@ -378,6 +390,7 @@ vector()
moveifchanged(path("vector.h.new"), path("vector.h"));
}
void
vector_devtab(fp, table, dev_idp)
FILE *fp;
char *table;

View File

@ -32,21 +32,30 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
* Make all the .h files for the optional entries
*/
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "config.h"
#include "y.tab.h"
#define ns(s) strdup(s)
void do_header __P((char *, char *, int));
void do_count __P((char *, char *, int));
void
headers()
{
register struct file_list *fl;
@ -60,6 +69,7 @@ headers()
* count all the devices of a certain type and recurse to count
* whatever the device is connected to
*/
void
do_count(dev, hname, search)
register char *dev, *hname;
int search;
@ -99,6 +109,7 @@ do_count(dev, hname, search)
do_header(dev, hname, count > hicount ? count : hicount);
}
void
do_header(dev, hname, count)
char *dev, *hname;
int count;
@ -114,10 +125,8 @@ do_header(dev, hname, count)
oldcount = -1;
if (inf == 0) {
outf = fopen(file, "w");
if (outf == 0) {
perror(file);
exit(1);
}
if (outf == 0)
err(1, "%s", file);
fprintf(outf, "#define %s %d\n", name, count);
(void) fclose(outf);
return;
@ -166,10 +175,8 @@ do_header(dev, hname, count)
fl_head = fl;
}
outf = fopen(file, "w");
if (outf == 0) {
perror(file);
exit(1);
}
if (outf == 0)
err(1, "%s", file);
for (fl = fl_head; fl != NULL; fl = tflp) {
fprintf(outf,
"#define %s %u\n", fl->f_fn, count ? fl->f_type : 0);

View File

@ -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;
{

View File

@ -32,7 +32,11 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
@ -41,9 +45,10 @@ static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93";
* additional files for the machine being compiled to.
*/
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "y.tab.h"
#include "config.h"
@ -68,6 +73,18 @@ static struct file_list *fcur;
char *tail();
extern int old_config_present;
void do_swapspec __P((FILE *, char *));
void do_clean __P((FILE *));
void do_load __P((FILE *));
void do_rules __P((FILE *));
void do_sfiles __P((FILE *));
void do_cfiles __P((FILE *));
void do_objs __P((FILE *));
void do_before_depend __P((FILE *));
int opteq __P((char *, char *));
void read_files __P((void));
void makefile __P((void));
/*
* Lookup a file, by name.
*/
@ -137,6 +154,7 @@ static struct users {
/*
* Build the makefile from the skeleton
*/
void
makefile()
{
FILE *ifp, *ofp;
@ -149,15 +167,11 @@ makefile()
strcpy(line, "Makefile.");
(void) strcat(line, machinename);
ifp = fopen(line, "r");
if (ifp == 0) {
perror(line);
exit(1);
}
if (ifp == 0)
err(1, "%s", line);
ofp = fopen(path("Makefile.new"), "w");
if (ofp == 0) {
perror(path("Makefile.new"));
exit(1);
}
if (ofp == 0)
err(1, "%s", path("Makefile.new"));
fprintf(ofp, "KERN_IDENT=%s\n", raise(ident));
fprintf(ofp, "IDENT=");
if (profiling)
@ -251,6 +265,7 @@ makefile()
* Read in the information about files used in making the system.
* Store it in the ftab linked list.
*/
void
read_files()
{
FILE *fp;
@ -267,10 +282,8 @@ read_files()
(void) snprintf(fname, sizeof fname, "../../conf/files");
openit:
fp = fopen(fname, "r");
if (fp == 0) {
perror(fname);
exit(1);
}
if (fp == 0)
err(1, "%s", fname);
if(ident == NULL) {
printf("no ident line specified\n");
exit(1);
@ -491,6 +504,7 @@ read_files()
goto next;
}
int
opteq(cp, dp)
char *cp, *dp;
{
@ -508,12 +522,12 @@ opteq(cp, dp)
}
}
void
do_before_depend(fp)
FILE *fp;
{
register struct file_list *tp, *fl;
register struct file_list *tp;
register int lpos, len;
char swapname[32];
fputs("BEFORE_DEPEND=", fp);
lpos = 15;
@ -534,6 +548,7 @@ do_before_depend(fp)
putc('\n', fp);
}
void
do_objs(fp)
FILE *fp;
{
@ -572,6 +587,7 @@ do_objs(fp)
putc('\n', fp);
}
void
do_cfiles(fp)
FILE *fp;
{
@ -611,6 +627,7 @@ do_cfiles(fp)
putc('\n', fp);
}
void
do_sfiles(fp)
FILE *fp;
{
@ -655,6 +672,7 @@ tail(fn)
* which avoids any problem areas with i/o addressing
* (e.g. for the VAX); assembler files are processed by as.
*/
void
do_rules(f)
FILE *f;
{
@ -725,6 +743,7 @@ do_rules(f)
/*
* Create the load strings
*/
void
do_load(f)
register FILE *f;
{
@ -742,12 +761,12 @@ do_load(f)
putc('\n', f);
}
void
do_clean(fp)
FILE *fp;
{
register struct file_list *tp, *fl;
register struct file_list *tp;
register int lpos, len;
char swapname[32];
fputs("CLEAN=", fp);
lpos = 7;
@ -785,6 +804,7 @@ do_systemspec(f, fl, first)
return (fl);
}
void
do_swapspec(f, name)
FILE *f;
register char *name;

View File

@ -33,30 +33,37 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
* Make all the .h files for the optional entries
*/
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "config.h"
#include "y.tab.h"
#define ns(s) strdup(s)
static char *lower __P((char *));
void read_options __P((void));
void do_option __P((char *));
void
options()
{
struct opt_list *ol;
/* fake the cpu types as options */
/* Please forgive me for this hack.. :-) */
struct opt *op;
struct cputype *cp;
for (cp = cputype; cp; cp = cp->cpu_next) {
@ -77,6 +84,7 @@ options()
* Generate an <options>.h file
*/
void
do_option(name)
char *name;
{
@ -105,10 +113,8 @@ do_option(name)
inf = fopen(file, "r");
if (inf == 0) {
outf = fopen(file, "w");
if (outf == 0) {
perror(file);
exit(1);
}
if (outf == 0)
err(1, "%s", file);
/* was the option in the config file? */
if (value) {
@ -177,10 +183,8 @@ do_option(name)
}
outf = fopen(file, "w");
if (outf == 0) {
perror(file);
exit(1);
}
if (outf == 0)
err(1, "%s", file);
for (op = op_head; op != NULL; op = topp) {
/* was the option in the config file? */
if (op->op_value) {
@ -223,6 +227,7 @@ tooption(name)
/*
* read the options and options.<machine> files
*/
void
read_options()
{
FILE *fp;

View File

@ -32,12 +32,18 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)mkswapconf.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
* Build a swap configuration file.
*/
#include <err.h>
#include <unistd.h>
#include "config.h"
#include <sys/disklabel.h>
@ -49,6 +55,9 @@ static char sccsid[] = "@(#)mkswapconf.c 8.1 (Berkeley) 6/6/93";
#define ns(s) strdup(s)
void initdevtable __P((void));
void
swapconf()
{
register struct file_list *fl;
@ -72,7 +81,6 @@ do_swap(fl)
char newswapname[80];
char swapname[80];
register struct file_list *swap;
dev_t dev;
if (eq(fl->f_fn, "generic")) {
fl = fl->f_next;
@ -81,10 +89,8 @@ do_swap(fl)
(void) sprintf(swapname, "swap%s.c", fl->f_fn);
(void) sprintf(newswapname, "swap%s.c.new", fl->f_fn);
fp = fopen(path(newswapname), "w");
if (fp == 0) {
perror(path(newswapname));
exit(1);
}
if (fp == 0)
err(1, "%s", path(newswapname));
fprintf(fp, "#include <sys/param.h>\n");
fprintf(fp, "#include <sys/conf.h>\n");
fprintf(fp, "\n");
@ -144,16 +150,13 @@ nametodev(name, defunit, defslice, defpartition)
register struct devdescription *dp;
cp = name;
if (cp == 0) {
fprintf(stderr, "config: internal error, nametodev\n");
exit(1);
}
if (cp == 0)
errx(1, "internal error, nametodev");
while (*cp && !isdigit(*cp))
cp++;
unit = *cp ? atoi(cp) : defunit;
if (unit < 0 || unit > 31) {
fprintf(stderr,
"config: %s: invalid device specification, unit out of range\n", name);
warnx("%s: invalid device specification, unit out of range", name);
unit = defunit; /* carry on more checking */
}
if (*cp) {
@ -167,8 +170,8 @@ nametodev(name, defunit, defslice, defpartition)
if (*cp) {
slice = atoi(cp);
if (slice < 0 || slice >= MAX_SLICES - 1) {
fprintf(stderr,
"config: %s: invalid device specification, slice out of range\n", cp);
warnx("%s: invalid device specification, slice out of range",
cp);
slice = defslice;
}
if (slice != COMPATIBILITY_SLICE)
@ -180,8 +183,7 @@ nametodev(name, defunit, defslice, defpartition)
}
partition = *cp ? *cp : defpartition;
if (partition < 'a' || partition > 'h') {
fprintf(stderr,
"config: %c: invalid device specification, bad partition\n", *cp);
warnx("%c: invalid device specification, bad partition", *cp);
partition = defpartition; /* carry on */
}
if (devtablenotread)
@ -190,7 +192,7 @@ nametodev(name, defunit, defslice, defpartition)
if (eq(name, dp->dev_name))
break;
if (dp == 0) {
fprintf(stderr, "config: %s: unknown device\n", name);
warnx("%s: unknown device", name);
return (NODEV);
}
return (makedev(dp->dev_major,
@ -229,6 +231,7 @@ devtoname(dev)
return (ns(buf));
}
void
initdevtable()
{
char linebuf[256];
@ -239,10 +242,8 @@ initdevtable()
(void) sprintf(buf, "../conf/devices.%s", machinename);
fp = fopen(buf, "r");
if (fp == NULL) {
fprintf(stderr, "config: can't open %s\n", buf);
exit(1);
}
if (fp == NULL)
errx(1, "can't open %s", buf);
while(fgets(linebuf,256,fp)) {
/*******************************\
* Allow a comment *

View File

@ -32,7 +32,11 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)mkubglue.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
@ -48,10 +52,8 @@ ubglue()
register struct device *dp, *mp;
fp = fopen(path("ubglue.s"), "w");
if (fp == 0) {
perror(path("ubglue.s"));
exit(1);
}
if (fp == 0)
err(1, "%s", path("ubglue.s"));
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (mp != 0 && mp != (struct device *)-1 &&