Update bootstrap files.
This commit is contained in:
35
output.c
35
output.c
@@ -1,10 +1,15 @@
|
||||
|
||||
#line 908 "nuweb.w"
|
||||
#include "global.h"
|
||||
void write_files(files)
|
||||
Name *files;
|
||||
|
||||
#line 3768 "nuweb.w"
|
||||
void write_files(Name *files)
|
||||
{
|
||||
while (files) {
|
||||
write_files(files->llink);
|
||||
/* Write out \verb|files->spelling| */
|
||||
|
||||
#line 3789 "nuweb.w"
|
||||
{
|
||||
static char temp_name[FILENAME_MAX];
|
||||
static char real_name[FILENAME_MAX];
|
||||
@@ -14,6 +19,8 @@ void write_files(files)
|
||||
|
||||
/* Find a free temporary file */
|
||||
|
||||
#line 3809 "nuweb.w"
|
||||
|
||||
for( temp_name_count = 0; temp_name_count < 10000; temp_name_count++) {
|
||||
sprintf(temp_name,"%s%snw%06d", dirpath, path_sep, temp_name_count);
|
||||
#ifdef O_EXCL
|
||||
@@ -38,6 +45,8 @@ void write_files(files)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#line 3796 "nuweb.w"
|
||||
|
||||
|
||||
sprintf(real_name, "%s%s%s", dirpath, path_sep, files->spelling);
|
||||
if (verbose_flag)
|
||||
@@ -49,8 +58,12 @@ void write_files(files)
|
||||
|
||||
/* Move the temporary file to the target, if required */
|
||||
|
||||
#line 3839 "nuweb.w"
|
||||
|
||||
if (compare_flag)
|
||||
/* Compare the temp file and the old file */
|
||||
|
||||
#line 3850 "nuweb.w"
|
||||
{
|
||||
FILE *old_file = fopen(real_name, "r");
|
||||
if (old_file) {
|
||||
@@ -68,34 +81,52 @@ void write_files(files)
|
||||
remove(real_name);
|
||||
/* Rename the temporary file to the target */
|
||||
|
||||
#line 3872 "nuweb.w"
|
||||
|
||||
if (0 != rename(temp_name, real_name)) {
|
||||
fprintf(stderr, "%s: can't rename output file to %s\n",
|
||||
command_name, real_name);
|
||||
}
|
||||
|
||||
#line 3865 "nuweb.w"
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Rename the temporary file to the target */
|
||||
|
||||
#line 3872 "nuweb.w"
|
||||
|
||||
if (0 != rename(temp_name, real_name)) {
|
||||
fprintf(stderr, "%s: can't rename output file to %s\n",
|
||||
command_name, real_name);
|
||||
}
|
||||
|
||||
#line 3869 "nuweb.w"
|
||||
|
||||
}
|
||||
#line 3841 "nuweb.w"
|
||||
|
||||
else {
|
||||
remove(real_name);
|
||||
/* Rename the temporary file to the target */
|
||||
|
||||
#line 3872 "nuweb.w"
|
||||
|
||||
if (0 != rename(temp_name, real_name)) {
|
||||
fprintf(stderr, "%s: can't rename output file to %s\n",
|
||||
command_name, real_name);
|
||||
}
|
||||
|
||||
#line 3844 "nuweb.w"
|
||||
|
||||
}
|
||||
|
||||
#line 3806 "nuweb.w"
|
||||
|
||||
}
|
||||
#line 3772 "nuweb.w"
|
||||
|
||||
files = files->rlink;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user