summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorEricSharkey <eric@lisaneric.org>2017-05-21 16:09:42 -0400
committerWill Estes <westes575@gmail.com>2017-07-03 09:41:42 -0400
commitc55bf919ccad3e0eff30da09c3d3e9f81cc123ad (patch)
tree02dbe606f63abd261fb3ec5e48160bd5dc673309 /src/main.c
parent8bd14f13878e8b36e84c57561b86a863e3a1093c (diff)
scanner: add optionn to specify backup filename.
In a directory containing multiple scanners, we want to allow specifying the name of the backup file else the backup files will be overwritten.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 337c40d..1f12cba 100644
--- a/src/main.c
+++ b/src/main.c
@@ -117,7 +117,7 @@ struct yytbl_writer tableswr;
char *program_name = "flex";
static const char outfile_template[] = "lex.%s.%s";
-static const char backing_name[] = "lex.backup";
+static const char *backing_name = "lex.backup";
static const char tablesfile_template[] = "lex.%s.tables";
/* From scan.l */
@@ -1035,6 +1035,11 @@ void flexinit (int argc, char **argv)
backing_up_report = true;
break;
+ case OPT_BACKUP_FILE:
+ backing_up_report = true;
+ backing_name = arg;
+ break;
+
case OPT_DONOTHING:
break;
@@ -1827,7 +1832,8 @@ void usage (void)
" -t, --stdout write scanner on stdout instead of %s\n"
" --yyclass=NAME name of C++ class\n"
" --header-file=FILE create a C header file in addition to the scanner\n"
- " --tables-file[=FILE] write tables to FILE\n" "\n"
+ " --tables-file[=FILE] write tables to FILE\n"
+ " --backup-file=FILE write backing-up information to FILE\n" "\n"
"Scanner behavior:\n"
" -7, --7bit generate 7-bit scanner\n"
" -8, --8bit generate 8-bit scanner\n"