summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-12-26 23:40:32 +0000
committerpeter <peter@FreeBSD.org>1996-12-26 23:40:32 +0000
commit164adbdd5665bcb0dea9ac6f4c56d00eb5147240 (patch)
treecbd677ab817eb3837eb8a8bb3da70574fa0f69f2 /usr.sbin/config
parente1f722b398a77cb4683a46732cd4f85139484926 (diff)
downloadFreeBSD-src-164adbdd5665bcb0dea9ac6f4c56d00eb5147240.zip
FreeBSD-src-164adbdd5665bcb0dea9ac6f4c56d00eb5147240.tar.gz
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.
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/main.c6
1 files changed, 4 insertions, 2 deletions
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"));
}
/*
OpenPOWER on IntegriCloud