Display outputting message only if not testing.

This commit is contained in:
Con Kolivas 2011-03-07 21:18:15 +11:00
parent 326cd29dd1
commit ef15ea28a8

8
main.c
View file

@ -164,7 +164,7 @@ static int open_tmpoutfile(void)
{ {
int fd_out; int fd_out;
if (STDOUT) if (STDOUT && !TEST_ONLY)
print_verbose("Outputting to stdout.\n"); print_verbose("Outputting to stdout.\n");
if (control.tmpdir) { if (control.tmpdir) {
control.outfile = realloc(NULL, strlen(control.tmpdir) + 16); control.outfile = realloc(NULL, strlen(control.tmpdir) + 16);
@ -191,7 +191,6 @@ void dump_tmpoutfile(int fd_out)
FILE *tmpoutfp; FILE *tmpoutfp;
int tmpchar; int tmpchar;
print_verbose("Dumping temporary file to stdout.\n");
/* flush anything not yet in the temporary file */ /* flush anything not yet in the temporary file */
fsync(fd_out); fsync(fd_out);
tmpoutfp = fdopen(fd_out, "r"); tmpoutfp = fdopen(fd_out, "r");
@ -200,12 +199,13 @@ void dump_tmpoutfile(int fd_out)
rewind(tmpoutfp); rewind(tmpoutfp);
if (!TEST_ONLY) { if (!TEST_ONLY) {
print_verbose("Dumping temporary file to stdout.\n");
while ((tmpchar = fgetc(tmpoutfp)) != EOF) while ((tmpchar = fgetc(tmpoutfp)) != EOF)
putchar(tmpchar); putchar(tmpchar);
fflush(stdout);
rewind(tmpoutfp);
} }
fflush(stdout);
rewind(tmpoutfp);
if (unlikely(ftruncate(fd_out, 0))) if (unlikely(ftruncate(fd_out, 0)))
fatal("Failed to ftruncate fd_out in dump_tmpoutfile\n"); fatal("Failed to ftruncate fd_out in dump_tmpoutfile\n");
} }