]> thyrsus.com Git - comparator.git/commitdiff
Make redirection work.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 16 Sep 2003 04:04:30 +0000 (04:04 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 16 Sep 2003 04:04:30 +0000 (04:04 +0000)
main.c

diff --git a/main.c b/main.c
index a22fde89dd4b9a2794484ad604992a2d68a2c94a..50a1bd8b8a619d6f984637a32cfcee4b9de345fb 100644 (file)
--- 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)
            {