summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/main.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-02-22 15:37:32 +0000
committerjkh <jkh@FreeBSD.org>1995-02-22 15:37:32 +0000
commit09d09cb93414bbd24504b169d0b193430574c4ab (patch)
treefcbd8ff64842af34da954f77c3f1e17a744e0448 /usr.sbin/config/main.c
parentfc2b47aebc779f9b2ace3a08a54f8aee1e2942b8 (diff)
downloadFreeBSD-src-09d09cb93414bbd24504b169d0b193430574c4ab.zip
FreeBSD-src-09d09cb93414bbd24504b169d0b193430574c4ab.tar.gz
Make good on my promise to finally clean up the config clobbering.
If you invoke config with the `-n' flag or have NO_CONFIG_CLOBBER in your environment, config will behave the same way it used to. This is now _documented_ as well. Rip out all the CONFIG_DONT_CLOBBER cruft; some of it wasn't even correct anyway.
Diffstat (limited to 'usr.sbin/config/main.c')
-rw-r--r--usr.sbin/config/main.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 804a3b8..e9029d0 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -49,7 +49,16 @@ static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#include "y.tab.h"
#include "config.h"
+#ifndef TRUE
+#define TRUE (1)
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
static char *PREFIX;
+static int no_config_clobber = FALSE;
/*
* Config builds a set of files for building a UNIX
@@ -66,7 +75,7 @@ main(argc, argv)
int ch;
char *p;
- while ((ch = getopt(argc, argv, "gp")) != EOF)
+ while ((ch = getopt(argc, argv, "gpn")) != EOF)
switch (ch) {
case 'g':
debugging++;
@@ -74,6 +83,9 @@ main(argc, argv)
case 'p':
profiling++;
break;
+ case 'n':
+ no_config_clobber = TRUE;
+ break;
case '?':
default:
goto usage;
@@ -82,7 +94,7 @@ main(argc, argv)
argv += optind;
if (argc != 1) {
-usage: fputs("usage: config [-gp] sysname\n", stderr);
+usage: fputs("usage: config [-gpn] sysname\n", stderr);
exit(1);
}
@@ -90,12 +102,11 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
perror(PREFIX);
exit(2);
}
-#ifdef CONFIG_DONT_CLOBBER
- if (stat(p = path((char *)NULL), &buf)) {
-#else /* CONFIG_DONT_CLOBBER */
+ if (getenv("NO_CONFIG_CLOBBER"))
+ no_config_clobber = TRUE;
+
p = path((char *)NULL);
if (stat(p, &buf)) {
-#endif /* CONFIG_DONT_CLOBBER */
if (mkdir(p, 0777)) {
perror(p);
exit(2);
@@ -104,9 +115,8 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
else if ((buf.st_mode & S_IFMT) != S_IFDIR) {
fprintf(stderr, "config: %s isn't a directory.\n", p);
exit(2);
-#ifndef CONFIG_DONT_CLOBBER
}
- else {
+ else if (!no_config_clobber) {
char tmp[strlen(p) + 8];
fprintf(stderr, "Removing old directory %s: ", p);
@@ -122,9 +132,7 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
perror(p);
exit(2);
}
-#endif /* CONFIG_DONT_CLOBBER */
}
-
loadaddress = -1;
dtab = NULL;
confp = &conf_list;
OpenPOWER on IntegriCloud