From c8c1e6f7b90b7fcbd1b389f63cd82411956fcdb5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 16 Sep 2003 04:04:30 +0000 Subject: [PATCH] Make redirection work. --- main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index a22fde8..50a1bd8 100644 --- a/main.c +++ b/main.c @@ -506,18 +506,15 @@ main(int argc, char *argv[]) } else if (compile_only) { - char *outfile = alloca(strlen(source) + 4); FILE *ofp; - strcpy(outfile, source); - strcat(outfile, ".scf"); - ofp = fopen(outfile, "w"); - if (!ofp) + if (!outfile) { - fprintf(stderr, "comparator: couldn't open output file %s\n", - outfile); - exit(1); + outfile = alloca(strlen(source) + 4); + strcpy(outfile, source); + strcat(outfile, ".scf"); } + ofp = redirect(outfile); if (dir) { -- 2.43.0