1
0
Fork 0

Codechange: settingsgen's CopyFile actually appends.

pull/12485/head
Peter Nelson 2024-04-12 12:13:38 +01:00
parent bb9b8b90c7
commit b42f7b698c
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 7 additions and 7 deletions

View File

@ -322,11 +322,11 @@ static void DumpSections(const IniLoadFile &ifile)
}
/**
* Copy a file to the output.
* @param fname Filename of file to copy.
* Append a file to the output stream.
* @param fname Filename of file to append.
* @param out_fp Output stream to write to.
*/
static void CopyFile(const char *fname, FILE *out_fp)
static void AppendFile(const char *fname, FILE *out_fp)
{
if (fname == nullptr) return;
@ -476,10 +476,10 @@ int CDECL main(int argc, char *argv[])
/* Write output. */
if (output_file == nullptr) {
CopyFile(before_file, stdout);
AppendFile(before_file, stdout);
_stored_output.Write(stdout);
_post_amble_output.Write(stdout);
CopyFile(after_file, stdout);
AppendFile(after_file, stdout);
} else {
static const char * const tmp_output = "tmp2.xxx";
@ -487,10 +487,10 @@ int CDECL main(int argc, char *argv[])
if (fp == nullptr) {
FatalError("Cannot open file {}", tmp_output);
}
CopyFile(before_file, fp);
AppendFile(before_file, fp);
_stored_output.Write(fp);
_post_amble_output.Write(fp);
CopyFile(after_file, fp);
AppendFile(after_file, fp);
fclose(fp);
if (CompareFiles(tmp_output, output_file)) {