entered into RCS

This commit is contained in:
David MacKenzie
1993-06-26 20:06:51 +00:00
parent a641b0dac1
commit cbd8ffc55d

View File

@@ -31,6 +31,9 @@ char *spec_name_prefix; /* for -p. */
char *spec_file_prefix; /* for -b. */ char *spec_file_prefix; /* for -b. */
extern int fixed_outfiles;/* for -y */ extern int fixed_outfiles;/* for -y */
extern char *program_name;
extern char *version_string;
extern void fatal(); extern void fatal();
struct option longopts[] = struct option longopts[] =
@@ -39,6 +42,7 @@ struct option longopts[] =
{"defines", 0, &definesflag, 1}, {"defines", 0, &definesflag, 1},
{"file-prefix", 1, 0, 'b'}, {"file-prefix", 1, 0, 'b'},
{"fixed-output-files", 0, &fixed_outfiles, 1}, {"fixed-output-files", 0, &fixed_outfiles, 1},
{"help", 0, 0, 'h'},
{"name-prefix", 1, 0, 'a'}, {"name-prefix", 1, 0, 'a'},
{"no-lines", 0, &nolinesflag, 1}, {"no-lines", 0, &nolinesflag, 1},
{"output", 1, 0, 'o'}, {"output", 1, 0, 'o'},
@@ -49,26 +53,34 @@ struct option longopts[] =
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
void
usage (stream)
FILE *stream;
{
fprintf (stream, "\
Usage: %s [-dhltvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n\
[--debug] [--defines] [--fixed-output-files] [--no-lines]\n\
[--verbose] [--version] [--help] [--yacc]\n\
[--file-prefix=prefix] [--name-prefix=prefix]\n\
[--output=outfile] grammar-file\n",
program_name);
}
void void
getargs(argc, argv) getargs(argc, argv)
int argc; int argc;
char *argv[]; char *argv[];
{ {
register int c; register int c;
int longind;
extern char *program_name;
extern char *version_string;
verboseflag = 0; verboseflag = 0;
definesflag = 0; definesflag = 0;
debugflag = 0; debugflag = 0;
fixed_outfiles = 0; fixed_outfiles = 0;
while ((c = getopt_long (argc, argv, "yvdltVo:b:p:", longopts, &longind)) while ((c = getopt_long (argc, argv, "yvdhltVo:b:p:", longopts, (int *)0))
!= EOF) != EOF)
{ {
if (c == 0 && longopts[longind].flag == 0)
c = longopts[longind].val;
switch (c) switch (c)
{ {
case 0: case 0:
@@ -79,9 +91,13 @@ getargs(argc, argv)
fixed_outfiles = 1; fixed_outfiles = 1;
break; break;
case 'h':
usage (stdout);
exit (0);
case 'V': case 'V':
printf("%s", version_string); printf ("%s", version_string);
break; exit (0);
case 'v': case 'v':
verboseflag = 1; verboseflag = 1;
@@ -112,13 +128,7 @@ getargs(argc, argv)
break; break;
default: default:
fprintf (stderr, "\ usage (stderr);
Usage: %s [-dltvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n\
[--debug] [--defines] [--fixed-output-files] [--no-lines]\n\
[--verbose] [--version] [--yacc]\n\
[--file-prefix=prefix] [--name-prefix=prefix]\n\
[--output=outfile] grammar-file\n",
program_name);
exit (1); exit (1);
} }
} }