summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1993-10-02 15:20:15 +0000
committerVern Paxson <vern@ee.lbl.gov>1993-10-02 15:20:15 +0000
commit759ab635e1695b80236ee1b4d4ea3b7586126ff5 (patch)
treea6aa41d0371ae1948042dd5e637cc8f83b680eb1
parentc5d8db8d39ab03dd579900b948b0e206bc0e5a0a (diff)
If -+ used, output to lex.yy.cc
-rw-r--r--main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.c b/main.c
index c9104a6..4678464 100644
--- 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 );