aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2001-06-16 03:41:45 +0000
committerH.J. Lu <hjl.tools@gmail.com>2001-06-16 03:41:45 +0000
commit5af9fd8b934ff64ddde002348c656deecee503b3 (patch)
tree5fbcbbf56b855943008babe71063715a0c3de576 /ld/lexsup.c
parenta2e50ba75ea37f90104288a5a95397889eea3ae7 (diff)
downloadgdb-5af9fd8b934ff64ddde002348c656deecee503b3.zip
gdb-5af9fd8b934ff64ddde002348c656deecee503b3.tar.gz
gdb-5af9fd8b934ff64ddde002348c656deecee503b3.tar.bz2
2001-06-15 H.J. Lu <hjl@gnu.org>
* lexsup.c (parse_args); Save optind to report unrecognized option.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 125bf73..e120c13 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -533,7 +533,7 @@ parse_args (argc, argv)
last_optind = -1;
while (1)
{
- int longind;
+ int longind, errind;
int optc;
/* Using last_optind lets us avoid calling ldemul_parse_args
@@ -552,6 +552,7 @@ parse_args (argc, argv)
/* getopt_long_only is like getopt_long, but '-' as well as '--'
can indicate a long option. */
opterr = 0;
+ errind = optind;
optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
if (optc == '?')
{
@@ -566,7 +567,7 @@ parse_args (argc, argv)
{
case '?':
fprintf (stderr, _("%s: unrecognized option '%s'\n"),
- program_name, argv[optind - 1]);
+ program_name, argv[errind]);
default:
fprintf (stderr,
_("%s: use the --help option for usage information\n"),