The DEFAULTS changes caused the user specified config file to be opened

much later than before, and it is now after we do a mkdir ../compile/FILE.
As a result, if you do 'config DOESNOTEXIST', it now creates the directory
../config/DOESNOTEXIST.  It did not do that before.  If DEFAULTS does not
exist, it still fails early before any permanent changes.

This shameless hack restores the old behavior of ensuring the config file
actually exists before mkdiring its counterpart directory.

Now I can rmdir ../compile/D and it will stay dead, after my fingers keep
sabotaging me with 'config D<tab><enter>'.  (Some of my kernel names
started with D, which used to be 1-character unique and my fingers knew
this very well...)
This commit is contained in:
Peter Wemm 2005-11-29 22:54:49 +00:00
parent 5a69e86294
commit 03349079fe

View File

@ -96,6 +96,7 @@ main(int argc, char **argv)
int ch, len;
char *p;
char xxx[MAXPATHLEN];
FILE *fp;
while ((ch = getopt(argc, argv, "d:gpV")) != -1)
switch (ch) {
@ -125,6 +126,10 @@ main(int argc, char **argv)
usage();
PREFIX = *argv;
fp = fopen(PREFIX, "r");
if (fp == NULL)
err(2, "%s", PREFIX);
fclose(fp);
if (freopen("DEFAULTS", "r", stdin) != NULL) {
found_defaults = 1;
yyfile = "DEFAULTS";