X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/8dd162d3ff10fd7fb6f748a885f8055232691c48..0a9f1c7d45cc2b5757377a871fde8003ac16a082:/src/getargs.c diff --git a/src/getargs.c b/src/getargs.c index 75968c0d..7bc9a767 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -1,7 +1,7 @@ /* Parse command line arguments for Bison. - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, + 2005, 2006 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,9 +17,10 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ +#include #include "system.h" #include @@ -103,11 +104,11 @@ static const int trace_types[] = trace_all }; +ARGMATCH_VERIFY (trace_args, trace_types); static void trace_argmatch (char *args) { - verify (trace_constraint, ARGMATCH_CONSTRAINT (trace_args, trace_types)); if (args) { args = strtok (args, ","); @@ -156,11 +157,11 @@ static const int report_types[] = report_all }; +ARGMATCH_VERIFY (report_args, report_types); static void report_argmatch (char *args) { - verify (report_constraint, ARGMATCH_CONSTRAINT (report_args, report_types)); args = strtok (args, ","); do { @@ -207,9 +208,10 @@ for the equivalent short option also. Similarly for optional arguments.\n"), fputs (_("\ Operation modes:\n\ - -h, --help display this help and exit\n\ - -V, --version output version information and exit\n\ - -y, --yacc emulate POSIX yacc\n"), stdout); + -h, --help display this help and exit\n\ + -V, --version output version information and exit\n\ + --print-localedir output directory containing locale-dependent data\n\ + -y, --yacc emulate POSIX yacc\n"), stdout); putc ('\n', stdout); fputs (_("\ @@ -269,7 +271,7 @@ version (void) putc ('\n', stdout); fprintf (stdout, - _("Copyright (C) %d Free Software Foundation, Inc.\n"), 2004); + _("Copyright (C) %d Free Software Foundation, Inc.\n"), 2006); fputs (_("\ This is free software; see the source for copying conditions. There is NO\n\ @@ -284,19 +286,21 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ `----------------------*/ /* Shorts options. */ -const char *short_options = "yvegdhr:ltknVo:b:p:S:T::"; +static char const short_options[] = "yvegdhr:ltknVo:b:p:S:T::"; /* Values for long options that do not have single-letter equivalents. */ enum { - LOCATIONS_OPTION = CHAR_MAX + 1 + LOCATIONS_OPTION = CHAR_MAX + 1, + PRINT_LOCALEDIR_OPTION }; static struct option const long_options[] = { /* Operation modes. */ - { "help", no_argument, 0, 'h' }, - { "version", no_argument, 0, 'V' }, + { "help", no_argument, 0, 'h' }, + { "version", no_argument, 0, 'V' }, + { "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION }, /* Parser. */ { "name-prefix", required_argument, 0, 'p' }, @@ -364,6 +368,10 @@ getargs (int argc, char *argv[]) version (); exit (EXIT_SUCCESS); + case PRINT_LOCALEDIR_OPTION: + printf ("%s\n", LOCALEDIR); + exit (EXIT_SUCCESS); + case 'g': /* Here, the -g and --graph=FILE options are differentiated. */ graph_flag = true;