diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 83ef42131371..081b4695eccc 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: mkmakefile.c,v 1.30 1998/06/09 14:02:07 dfr Exp $"; + "$Id: mkmakefile.c,v 1.31 1998/06/24 06:16:32 jkh Exp $"; #endif /* not lint */ /* @@ -136,24 +136,6 @@ new_fent() return (fp); } -static struct users { - int u_default; - int u_min; - int u_max; -} users[] = { - { 8, 2, 512 }, /* MACHINE_VAX */ - { 8, 2, 512 }, /* MACHINE_TAHOE */ - { 8, 2, 512 }, /* MACHINE_HP300 */ - { 8, 2, 512 }, /* MACHINE_I386 */ - { 8, 2, 512 }, /* MACHINE_MIPS */ - { 8, 2, 512 }, /* MACHINE_PMAX */ - { 8, 2, 512 }, /* MACHINE_LUNA68K */ - { 8, 2, 512 }, /* MACHINE_NEWS3400 */ - { 8, 2, 512 }, /* MACHINE_PC98 */ - { 8, 2, 512 }, /* MACHINE_ALPHA */ -}; -#define NUSERS (sizeof (users) / sizeof (users[0])) - /* * Build the makefile from the skeleton */ @@ -163,7 +145,6 @@ makefile() FILE *ifp, *ofp; char line[BUFSIZ]; struct opt *op; - struct users *up; int warn_make_clean = 0; int versreq; @@ -185,13 +166,6 @@ makefile() printf("cpu type must be specified\n"); exit(1); } -#if 0 - /* XXX: moved to cputype.h */ - { struct cputype *cp; - for (cp = cputype; cp; cp = cp->cpu_next) - fprintf(ofp, " -D%s", cp->cpu_name); - } -#endif for (op = opt; op; op = op->op_next) { if (!op->op_ownfile) { warn_make_clean++; @@ -204,20 +178,6 @@ makefile() } } fprintf(ofp, "\n"); - if ((unsigned)machine > NUSERS) { - printf("maxusers config info isn't present, using vax\n"); - up = &users[MACHINE_VAX-1]; - } else - up = &users[machine-1]; - if (maxusers == 0) { - printf("maxusers not specified; %d assumed\n", up->u_default); - maxusers = up->u_default; - } else if (maxusers < up->u_min) { - printf("minimum of %d maxusers assumed\n", up->u_min); - maxusers = up->u_min; - } else if (maxusers > up->u_max) - printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers); - fprintf(ofp, "PARAM=-DMAXUSERS=%d\n", maxusers); if (loadaddress != -1) { fprintf(ofp, "LOAD_ADDRESS=%X\n", loadaddress); } diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index 45e6780631d2..e638f2064129 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: mkoptions.c,v 1.6 1997/09/15 06:37:10 charnier Exp $"; + "$Id: mkoptions.c,v 1.7 1998/07/12 02:31:08 bde Exp $"; #endif /* not lint */ /* @@ -53,6 +53,24 @@ static const char rcsid[] = #define ns(s) strdup(s) +static struct users { + int u_default; + int u_min; + int u_max; +} users[] = { + { 8, 2, 512 }, /* MACHINE_VAX */ + { 8, 2, 512 }, /* MACHINE_TAHOE */ + { 8, 2, 512 }, /* MACHINE_HP300 */ + { 8, 2, 512 }, /* MACHINE_I386 */ + { 8, 2, 512 }, /* MACHINE_MIPS */ + { 8, 2, 512 }, /* MACHINE_PMAX */ + { 8, 2, 512 }, /* MACHINE_LUNA68K */ + { 8, 2, 512 }, /* MACHINE_NEWS3400 */ + { 8, 2, 512 }, /* MACHINE_PC98 */ + { 8, 2, 512 }, /* MACHINE_ALPHA */ +}; +#define NUSERS (sizeof (users) / sizeof (users[0])) + static char *lower __P((char *)); void read_options __P((void)); void do_option __P((char *)); @@ -60,21 +78,45 @@ void do_option __P((char *)); void options() { - struct opt_list *ol; - - /* fake the cpu types as options */ - /* Please forgive me for this hack.. :-) */ + char buf[40]; struct cputype *cp; + struct opt_list *ol; + struct opt *op; + struct users *up; - for (cp = cputype; cp; cp = cp->cpu_next) { - struct opt *op = (struct opt *)malloc(sizeof (struct opt)); + /* Fake the cpu types as options. */ + for (cp = cputype; cp != NULL; cp = cp->cpu_next) { + op = (struct opt *)malloc(sizeof(*op)); memset(op, 0, sizeof(*op)); op->op_name = ns(cp->cpu_name); - op->op_value = 0; op->op_next = opt; opt = op; } + /* Initialize `maxusers'. */ + if ((unsigned)machine > NUSERS) { + printf("maxusers config info isn't present, using vax\n"); + up = &users[MACHINE_VAX - 1]; + } else + up = &users[machine - 1]; + if (maxusers == 0) { + printf("maxusers not specified; %d assumed\n", up->u_default); + maxusers = up->u_default; + } else if (maxusers < up->u_min) { + printf("minimum of %d maxusers assumed\n", up->u_min); + maxusers = up->u_min; + } else if (maxusers > up->u_max) + printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers); + + /* Fake MAXUSERS as an option. */ + op = (struct opt *)malloc(sizeof(*op)); + memset(op, 0, sizeof(*op)); + op->op_name = "MAXUSERS"; + sprintf(buf, "%d", maxusers); + op->op_value = ns(buf); + op->op_next = opt; + opt = op; + read_options(); for (ol = otab; ol != 0; ol = ol->o_next) do_option(ol->o_name);