From 164adbdd5665bcb0dea9ac6f4c56d00eb5147240 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 26 Dec 1996 23:40:32 +0000 Subject: Tidy up the generated config.c file. Use #include "opt_config.h", comment out text after #endif line, add missing \n at end of file, only install new config.c if it's different to the last one which preserves the timestamp. --- usr.sbin/config/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usr.sbin/config/main.c') diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 76f9a55..4d3cccb 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -344,11 +344,12 @@ configfile() perror(PREFIX); exit(2); } - fo = fopen(p=path("config.c"),"w"); + fo = fopen(p=path("config.c.new"),"w"); if(!fo) { perror(p); exit(2); } + fprintf(fo,"#include \"opt_config.h\"\n"); fprintf(fo,"#ifdef INCLUDE_CONFIG_FILE \n"); fprintf(fo,"static char *config = \"\n"); fprintf(fo,"START CONFIG FILE %s\n___",PREFIX); @@ -365,9 +366,10 @@ configfile() } fprintf(fo,"\nEND CONFIG FILE %s\n",PREFIX); fprintf(fo,"\";\n"); - fprintf(fo,"\n#endif INCLUDE_CONFIG_FILE"); + fprintf(fo,"\n#endif /* INCLUDE_CONFIG_FILE */\n"); fclose(fi); fclose(fo); + moveifchanged(path("config.c.new"), path("config.c")); } /* -- cgit v1.1