diff options
author | Alan Modra <amodra@gmail.com> | 2001-12-13 09:38:11 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2001-12-13 09:38:11 +0000 |
commit | 89894c62c6d197265565a007edcf5ddc74d5a1d8 (patch) | |
tree | 1e8eec3a6e416e2a6cf94700386a066b329048b3 /ld/lexsup.c | |
parent | ae53364610e53bb7551c33dbb85adc6442cdf412 (diff) | |
download | gdb-89894c62c6d197265565a007edcf5ddc74d5a1d8.zip gdb-89894c62c6d197265565a007edcf5ddc74d5a1d8.tar.gz gdb-89894c62c6d197265565a007edcf5ddc74d5a1d8.tar.bz2 |
* lexsup.c (parse_args): Don't pass shortopts to second call to
getopt functions. Restore optind rather than decrementing before
second call. Remove errind as it now duplicates last_optind.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r-- | ld/lexsup.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c index b9b74bd..ca2e9a1 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -542,7 +542,7 @@ parse_args (argc, argv) last_optind = -1; while (1) { - int longind, errind; + int longind; int optc; /* Using last_optind lets us avoid calling ldemul_parse_args @@ -552,21 +552,18 @@ parse_args (argc, argv) -nx, in which the -n is parsed as a single option, and we loop around to pick up the -x. */ if (optind != last_optind) - { - if (ldemul_parse_args (argc, argv)) - continue; - last_optind = optind; - } + if (ldemul_parse_args (argc, argv)) + continue; /* getopt_long_only is like getopt_long, but '-' as well as '--' can indicate a long option. */ opterr = 0; - errind = optind; + last_optind = optind; optc = getopt_long_only (argc, argv, shortopts, longopts, &longind); if (optc == '?') { - --optind; - optc = getopt_long (argc, argv, shortopts, really_longopts, &longind); + optind = last_optind; + optc = getopt_long (argc, argv, "-", really_longopts, &longind); } if (optc == -1) @@ -575,7 +572,7 @@ parse_args (argc, argv) switch (optc) { case '?': - einfo (_("%P: unrecognized option '%s'\n"), argv[errind]); + einfo (_("%P: unrecognized option '%s'\n"), argv[last_optind]); default: einfo (_("%P%F: use the --help option for usage information\n")); |