]> granicus.if.org Git - flex/commitdiff
If -+ used, output to lex.yy.cc
authorVern Paxson <vern@ee.lbl.gov>
Sat, 2 Oct 1993 15:20:15 +0000 (15:20 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Sat, 2 Oct 1993 15:20:15 +0000 (15:20 +0000)
main.c

diff --git a/main.c b/main.c
index c9104a6b780739961512328148428698cea5d75e..4678464dabaa8a68d57308a1edb08d9565097568 100644 (file)
--- a/main.c
+++ b/main.c
@@ -97,9 +97,9 @@ int num_input_files;
 char *program_name;
 
 #ifndef SHORT_FILE_NAMES
-static char *outfile_template = "lex.%s.c";
+static char *outfile_template = "lex.%s.%s";
 #else
-static char *outfile_template = "lex%s.c";
+static char *outfile_template = "lex%s.%s";
 #endif
 static char outfile_path[64];
 
@@ -643,8 +643,14 @@ char **argv;
        if ( ! use_stdout )
                {
                FILE *prev_stdout;
+               char *suffix;
 
-               sprintf( outfile_path, outfile_template, prefix );
+               if ( C_plus_plus )
+                       suffix = "cc";
+               else
+                       suffix = "c";
+
+               sprintf( outfile_path, outfile_template, prefix, suffix );
 
                prev_stdout = freopen( outfile_path, "w", stdout );