projects
/
bison.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
maint: factor the handling of %printer and %destructor
[bison.git]
/
src
/
getargs.c
diff --git
a/src/getargs.c
b/src/getargs.c
index e5d1faa362e06da8fdedf5bcce90f3411468da5d..82e4e356064263a08274f90e6f4488d002994860 100644
(file)
--- a/
src/getargs.c
+++ b/
src/getargs.c
@@
-40,6
+40,8
@@
# undef HACK_FOR___GNU_LIBRARY___PROTOTYPE
#endif
# undef HACK_FOR___GNU_LIBRARY___PROTOTYPE
#endif
+#include <progname.h>
+
#include "complain.h"
#include "files.h"
#include "getargs.h"
#include "complain.h"
#include "files.h"
#include "getargs.h"
@@
-75,8
+77,6
@@
int language_prio = default_prio;
struct bison_language const *language = &valid_languages[0];
const char *include = NULL;
struct bison_language const *language = &valid_languages[0];
const char *include = NULL;
-char *program_name;
-
/** Decode an option's set of keys.
*
/** Decode an option's set of keys.
*
@@
-102,7
+102,7
@@
flags_argmatch (const char *option,
args = strtok (args, ",");
while (args)
{
args = strtok (args, ",");
while (args)
{
- int no =
strncmp (args, "no-", 3) == 0
? 3 : 0;
+ int no =
STRPREFIX_LIT ("no-", args)
? 3 : 0;
int value = XARGMATCH (option, args + no, keys, values);
if (value == 0)
{
int value = XARGMATCH (option, args + no, keys, values);
if (value == 0)
{
@@
-559,7
+559,7
@@
getargs (int argc, char *argv[])
case 'F': /* -FNAME[=VALUE]. */
{
char* name = optarg;
case 'F': /* -FNAME[=VALUE]. */
{
char* name = optarg;
- char* value =
mbs
chr (optarg, '=');
+ char* value =
str
chr (optarg, '=');
if (value)
*value++ = 0;
muscle_percent_define_insert (name, command_line_location (),
if (value)
*value++ = 0;
muscle_percent_define_insert (name, command_line_location (),
@@
-603,13
+603,19
@@
getargs (int argc, char *argv[])
/* Here, the -d and --defines options are differentiated. */
defines_flag = true;
if (optarg)
/* Here, the -d and --defines options are differentiated. */
defines_flag = true;
if (optarg)
- spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_defines_file);
+ spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'g':
graph_flag = true;
if (optarg)
break;
case 'g':
graph_flag = true;
if (optarg)
- spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_graph_file);
+ spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'h':
break;
case 'h':
@@
-648,7
+654,10
@@
getargs (int argc, char *argv[])
case 'x':
xml_flag = true;
if (optarg)
case 'x':
xml_flag = true;
if (optarg)
- spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_xml_file);
+ spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'y':
break;
case 'y':
@@
-665,10
+674,11
@@
getargs (int argc, char *argv[])
exit (EXIT_SUCCESS);
case PRINT_DATADIR_OPTION:
exit (EXIT_SUCCESS);
case PRINT_DATADIR_OPTION:
- printf ("%s\n",
compute_
pkgdatadir ());
+ printf ("%s\n", pkgdatadir ());
exit (EXIT_SUCCESS);
case REPORT_FILE_OPTION:
exit (EXIT_SUCCESS);
case REPORT_FILE_OPTION:
+ free (spec_verbose_file);
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break;
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break;