diff options
author | jkh <jkh@FreeBSD.org> | 1996-06-08 23:27:16 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-06-08 23:27:16 +0000 |
commit | 91826e819af133ca9839fa2ec5087e87f336e699 (patch) | |
tree | bd1a8065d30ceda1e0825eb79e1c03c7d5f7c1ae /usr.sbin/config/main.c | |
parent | 3d420212c7ea85c09391275efbfb726a5aa7d448 (diff) | |
download | FreeBSD-src-91826e819af133ca9839fa2ec5087e87f336e699.zip FreeBSD-src-91826e819af133ca9839fa2ec5087e87f336e699.tar.gz |
Bring back the `config file in the kernel' feature from the 1.x days. This
is conditionalized by the INCLUDE_CONFIG_FILE option in your kernel config
file and is not turned on by default.
Submitted-By: Bill Pechter <pechter@shell.monmouth.com>
Diffstat (limited to 'usr.sbin/config/main.c')
-rw-r--r-- | usr.sbin/config/main.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index a203769..76f9a55 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -199,6 +199,7 @@ usage: fputs("usage: config [-gpn] sysname\n", stderr); makefile(); /* build Makefile */ headers(); /* make a lot of .h files */ swapconf(); /* swap config files */ + configfile(); /* put config file into kernel*/ printf("Kernel build directory is %s\n", p); exit(0); } @@ -332,6 +333,43 @@ path(file) return (cp); } +configfile() +{ + FILE *fi, *fo; + char *p; + int i; + + fi = fopen(PREFIX,"r"); + if(!fi) { + perror(PREFIX); + exit(2); + } + fo = fopen(p=path("config.c"),"w"); + if(!fo) { + perror(p); + exit(2); + } + fprintf(fo,"#ifdef INCLUDE_CONFIG_FILE \n"); + fprintf(fo,"static char *config = \"\n"); + fprintf(fo,"START CONFIG FILE %s\n___",PREFIX); + while (EOF != (i=getc(fi))) { + if(i == '\n') { + fprintf(fo,"\n___"); + } else if(i == '\"') { + fprintf(fo,"\\\""); + } else if(i == '\\') { + fprintf(fo,"\\\\"); + } else { + putc(i,fo); + } + } + fprintf(fo,"\nEND CONFIG FILE %s\n",PREFIX); + fprintf(fo,"\";\n"); + fprintf(fo,"\n#endif INCLUDE_CONFIG_FILE"); + fclose(fi); + fclose(fo); +} + /* * moveifchanged -- * compare two files; rename if changed. |