| 336 | ****************************************************************************/ |
| 337 | |
| 338 | static void append_file(const char *filename) |
| 339 | { |
| 340 | FILE *stream; |
| 341 | int ch; |
| 342 | |
| 343 | /* Open the file for reading */ |
| 344 | |
| 345 | stream = fopen(filename, "r"); |
| 346 | if (!stream) |
| 347 | { |
| 348 | error("open %s failed: %s\n", filename, strerror(errno)); |
| 349 | exit(ERROR_APPENDFILE_OPEN_FAILURE); |
| 350 | } |
| 351 | |
| 352 | /* Copy the file to the output */ |
| 353 | |
| 354 | while ((ch = getc(stream)) != EOF) |
| 355 | { |
| 356 | putc(ch, g_outfile); |
| 357 | } |
| 358 | |
| 359 | /* Close and remove the file */ |
| 360 | |
| 361 | fclose(stream); |
| 362 | unlink(filename); |
| 363 | } |
| 364 | |
| 365 | /**************************************************************************** |
| 366 | * Name: show_usage |