aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/yacc/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/yacc/main.c')
-rw-r--r--usr.bin/yacc/main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c
index 79b332a237e7..8b7f36ff027f 100644
--- a/usr.bin/yacc/main.c
+++ b/usr.bin/yacc/main.c
@@ -144,7 +144,7 @@ set_signals()
usage()
{
- fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] [-p symbol_prefix] filename\n", myname);
+ fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] [-o output_file_name] [-p symbol_prefix] filename\n", myname);
exit(1);
}
@@ -189,6 +189,15 @@ char *argv[];
lflag = 1;
break;
+ case 'o':
+ if (*++s)
+ output_file_name = s;
+ else if (++i < argc)
+ output_file_name = argv[i];
+ else
+ usage();
+ continue;
+
case 'p':
if (*++s)
symbol_prefix = s;
@@ -316,11 +325,13 @@ create_file_names()
len = strlen(file_prefix);
+ if (!output_file_name) {
output_file_name = MALLOC(len + 7);
if (output_file_name == 0)
no_space();
strcpy(output_file_name, file_prefix);
strcpy(output_file_name + len, OUTPUT_SUFFIX);
+ }
if (rflag)
{