From: Eric S. Raymond Date: Tue, 16 Sep 2003 04:04:30 +0000 (+0000) Subject: Make redirection work. X-Git-Tag: 2.0~57 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=c8c1e6f7b90b7fcbd1b389f63cd82411956fcdb5;p=comparator.git Make redirection work. --- 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) {