From 98a21b020e21c76a82fcf59dac4d7eab8e032ee9 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 14 Mar 2006 15:41:57 +0000 Subject: [PATCH] * as.c (std_longopts[]): Add an entry for "al" to prevent -al from being confused with --alternate. (parse_args): Update code to find the start of the parameters to the -a switch. --- gas/ChangeLog | 7 +++++++ gas/as.c | 22 +++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index b00e0d25acc..96b9702b57b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2006-03-14 Nick Clifton + + * as.c (std_longopts[]): Add an entry for "al" to prevent -al from + being confused with --alternate. + (parse_args): Update code to find the start of the parameters to + the -a switch. + 2005-06-12 Daniel Jacobowitz Backport from mainline: diff --git a/gas/as.c b/gas/as.c index 919025e3788..0b5222ae0c4 100644 --- a/gas/as.c +++ b/gas/as.c @@ -437,11 +437,12 @@ parse_args (int * pargc, char *** pargv) the end of the preceeding line so that it is simpler to selectively add and remove lines from this list. */ {"alternate", no_argument, NULL, OPTION_ALTERNATE} - /* The entry for "a" is here to prevent getopt_long_only() from - considering that -a is an abbreviation for --alternate. This is - necessary because -a= is a valid switch but getopt would - normally reject it since --alternate does not take an argument. */ + /* The next two entries are here to prevent getopt_long_only() from + considering that -a or -al is an abbreviation for --alternate. + This is necessary because -a= is a valid switch but getopt + would normally reject it since --alternate does not take an argument. */ ,{"a", optional_argument, NULL, 'a'} + ,{"al", optional_argument, NULL, 'a'} ,{"defsym", required_argument, NULL, OPTION_DEFSYM} ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG} ,{"emulation", required_argument, NULL, OPTION_EMULATION} @@ -791,8 +792,15 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case 'a': if (optarg) { - if (optarg != old_argv[optind] && optarg[-1] == '=') - --optarg; + /* If optarg is part of the -a switch and not a separate argument + in its own right, then scan backwards to the just after the -a. + This means skipping over both '=' and 'l' which might have been + taken to be part of the -a switch itself. */ + if (optarg != old_argv[optind]) + { + while (optarg[-1] == '=' || optarg[-1] == 'l') + --optarg; + } if (md_parse_option (optc, optarg) != 0) break; @@ -1205,7 +1213,7 @@ main (int argc, char ** argv) keep_it = 0; if (!keep_it) - unlink_if_ordinary (out_file_name); + unlink (out_file_name); input_scrub_end (); -- 2.47.2