From 2dae0c7cb0c52836f7c1c0ab5ee17185ee5445f4 Mon Sep 17 00:00:00 2001 From: cgd Date: Sat, 8 Jan 1994 10:33:43 +0000 Subject: [PATCH] add support for "machinearch" internal variable. if "machinearch" is different than the "machinename" internal variable, read machinearch's files.${machinearch} and add it to the list of files for the machine. Also, regardless of whether or not they're different, create a ${machinearch} sylink (or directory) pointing to the machinearch include files (or containing them). --- usr.sbin/config.old/config.h | 3 ++- usr.sbin/config.old/config.y | 8 +++++++- usr.sbin/config.old/main.c | 11 ++++++++--- usr.sbin/config.old/mkmakefile.c | 12 +++++++++++- usr.sbin/config/config.h | 3 ++- usr.sbin/config/config.y | 8 +++++++- usr.sbin/config/main.c | 11 ++++++++--- usr.sbin/config/mkmakefile.c | 12 +++++++++++- 8 files changed, 56 insertions(+), 12 deletions(-) diff --git a/usr.sbin/config.old/config.h b/usr.sbin/config.old/config.h index c574b66cf9e2..f928eb41ad75 100644 --- a/usr.sbin/config.old/config.h +++ b/usr.sbin/config.old/config.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)config.h 5.14 (Berkeley) 7/1/91 - * $Id: config.h,v 1.10 1993/10/15 23:26:39 cgd Exp $ + * $Id: config.h,v 1.11 1994/01/08 10:33:43 cgd Exp $ */ /* @@ -135,6 +135,7 @@ struct config { */ int machine; char *machinename; +char *machinearch; #define MACHINE_VAX 1 #define MACHINE_TAHOE 2 #define MACHINE_HP300 3 diff --git a/usr.sbin/config.old/config.y b/usr.sbin/config.old/config.y index 8bfa9c317ea2..a53e5165d40d 100644 --- a/usr.sbin/config.old/config.y +++ b/usr.sbin/config.old/config.y @@ -104,7 +104,7 @@ * SUCH DAMAGE. * * from: @(#)config.y 5.14 (Berkeley) 7/1/91 - * $Id: config.y,v 1.9 1993/12/01 05:56:39 deraadt Exp $ + * $Id: config.y,v 1.10 1994/01/08 10:33:53 cgd Exp $ */ #include "config.h" @@ -147,21 +147,27 @@ Config_spec: if (!strcmp($2, "vax")) { machine = MACHINE_VAX; machinename = "vax"; + machinearch = machinename; } else if (!strcmp($2, "tahoe")) { machine = MACHINE_TAHOE; machinename = "tahoe"; + machinearch = machinename; } else if (!strcmp($2, "hp300")) { machine = MACHINE_HP300; machinename = "hp300"; + machinearch = "m68k"; } else if (!strcmp($2, "i386")) { machine = MACHINE_I386; machinename = "i386"; + machinearch = machinename; } else if (!strcmp($2, "pc532")) { machine = MACHINE_PC532; machinename = "pc532"; + machinearch = machinename; } else if (!strcmp($2, "pmax")) { machine = MACHINE_PMAX; machinename = "pmax"; + machinearch = machinename; } else yyerror("Unknown machine type"); } | diff --git a/usr.sbin/config.old/main.c b/usr.sbin/config.old/main.c index 47fbb0279f77..680f5483fb73 100644 --- a/usr.sbin/config.old/main.c +++ b/usr.sbin/config.old/main.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)main.c 5.17 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$Id: main.c,v 1.7 1993/10/14 01:22:31 deraadt Exp $"; +static char rcsid[] = "$Id: main.c,v 1.8 1994/01/08 10:33:57 cgd Exp $"; #endif /* not lint */ #include @@ -151,15 +151,20 @@ usage: fputs("usage: config [-gkp] sysname\n", stderr); * and similarly for "machine". */ { - char xxx[80]; + char xxx[200]; #ifndef NO_SYMLINK - (void) sprintf(xxx, "../../include", machinename); + (void) sprintf(xxx, "../../include"); (void) symlink(xxx, path("machine")); + (void) sprintf(xxx, "../../../%s/include", machinearch); + (void) symlink(xxx, path(machinearch)); #else sprintf (xxx, "/bin/rm -rf %s; /bin/cp -r ../include %s", path("machine"), path("machine")); system (xxx); + sprintf (xxx, "/bin/rm -rf %s; /bin/cp -r ../../%s/include %s", + path(machinearch), machinearch, path(machinearch)); + system (xxx); #endif } makefile(); /* build Makefile */ diff --git a/usr.sbin/config.old/mkmakefile.c b/usr.sbin/config.old/mkmakefile.c index 3e8b43baecc7..882ea43b8045 100644 --- a/usr.sbin/config.old/mkmakefile.c +++ b/usr.sbin/config.old/mkmakefile.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)mkmakefile.c 5.33 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$Id: mkmakefile.c,v 1.18 1993/10/14 01:22:35 deraadt Exp $"; +static char rcsid[] = "$Id: mkmakefile.c,v 1.19 1994/01/08 10:34:01 cgd Exp $"; #endif /* not lint */ /* @@ -239,12 +239,22 @@ read_files() read_file(fname,1,0); (void) sprintf(fname, "files.%s", machinename); read_file(fname,1,0); + if (strcmp(machinearch, machinename)) { + (void) sprintf(fname, "../../%s/conf/files.%s", machinearch, + machinearch); + read_file(fname,1,0); + } (void) sprintf(fname, "files.%s", raise(ident)); read_file(fname,0,1); (void) strcpy(fname, "../../../conf/options"); read_file(fname,0,0); (void) sprintf(fname, "options.%s", machinename); read_file(fname,0,0); + if (strcmp(machinearch, machinename)) { + (void) sprintf(fname, "../../%s/conf/options.%s", machinearch, + machinearch); + read_file(fname,0,0); + } (void) sprintf(fname, "options.%s", raise(ident)); read_file(fname,0,1); } diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index c574b66cf9e2..f928eb41ad75 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)config.h 5.14 (Berkeley) 7/1/91 - * $Id: config.h,v 1.10 1993/10/15 23:26:39 cgd Exp $ + * $Id: config.h,v 1.11 1994/01/08 10:33:43 cgd Exp $ */ /* @@ -135,6 +135,7 @@ struct config { */ int machine; char *machinename; +char *machinearch; #define MACHINE_VAX 1 #define MACHINE_TAHOE 2 #define MACHINE_HP300 3 diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 8bfa9c317ea2..a53e5165d40d 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -104,7 +104,7 @@ * SUCH DAMAGE. * * from: @(#)config.y 5.14 (Berkeley) 7/1/91 - * $Id: config.y,v 1.9 1993/12/01 05:56:39 deraadt Exp $ + * $Id: config.y,v 1.10 1994/01/08 10:33:53 cgd Exp $ */ #include "config.h" @@ -147,21 +147,27 @@ Config_spec: if (!strcmp($2, "vax")) { machine = MACHINE_VAX; machinename = "vax"; + machinearch = machinename; } else if (!strcmp($2, "tahoe")) { machine = MACHINE_TAHOE; machinename = "tahoe"; + machinearch = machinename; } else if (!strcmp($2, "hp300")) { machine = MACHINE_HP300; machinename = "hp300"; + machinearch = "m68k"; } else if (!strcmp($2, "i386")) { machine = MACHINE_I386; machinename = "i386"; + machinearch = machinename; } else if (!strcmp($2, "pc532")) { machine = MACHINE_PC532; machinename = "pc532"; + machinearch = machinename; } else if (!strcmp($2, "pmax")) { machine = MACHINE_PMAX; machinename = "pmax"; + machinearch = machinename; } else yyerror("Unknown machine type"); } | diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 47fbb0279f77..680f5483fb73 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)main.c 5.17 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$Id: main.c,v 1.7 1993/10/14 01:22:31 deraadt Exp $"; +static char rcsid[] = "$Id: main.c,v 1.8 1994/01/08 10:33:57 cgd Exp $"; #endif /* not lint */ #include @@ -151,15 +151,20 @@ usage: fputs("usage: config [-gkp] sysname\n", stderr); * and similarly for "machine". */ { - char xxx[80]; + char xxx[200]; #ifndef NO_SYMLINK - (void) sprintf(xxx, "../../include", machinename); + (void) sprintf(xxx, "../../include"); (void) symlink(xxx, path("machine")); + (void) sprintf(xxx, "../../../%s/include", machinearch); + (void) symlink(xxx, path(machinearch)); #else sprintf (xxx, "/bin/rm -rf %s; /bin/cp -r ../include %s", path("machine"), path("machine")); system (xxx); + sprintf (xxx, "/bin/rm -rf %s; /bin/cp -r ../../%s/include %s", + path(machinearch), machinearch, path(machinearch)); + system (xxx); #endif } makefile(); /* build Makefile */ diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 3e8b43baecc7..882ea43b8045 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)mkmakefile.c 5.33 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$Id: mkmakefile.c,v 1.18 1993/10/14 01:22:35 deraadt Exp $"; +static char rcsid[] = "$Id: mkmakefile.c,v 1.19 1994/01/08 10:34:01 cgd Exp $"; #endif /* not lint */ /* @@ -239,12 +239,22 @@ read_files() read_file(fname,1,0); (void) sprintf(fname, "files.%s", machinename); read_file(fname,1,0); + if (strcmp(machinearch, machinename)) { + (void) sprintf(fname, "../../%s/conf/files.%s", machinearch, + machinearch); + read_file(fname,1,0); + } (void) sprintf(fname, "files.%s", raise(ident)); read_file(fname,0,1); (void) strcpy(fname, "../../../conf/options"); read_file(fname,0,0); (void) sprintf(fname, "options.%s", machinename); read_file(fname,0,0); + if (strcmp(machinearch, machinename)) { + (void) sprintf(fname, "../../%s/conf/options.%s", machinearch, + machinearch); + read_file(fname,0,0); + } (void) sprintf(fname, "options.%s", raise(ident)); read_file(fname,0,1); }