From 5af9fd8b934ff64ddde002348c656deecee503b3 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 16 Jun 2001 03:41:45 +0000 Subject: [PATCH] 2001-06-15 H.J. Lu * lexsup.c (parse_args); Save optind to report unrecognized option. --- ld/ChangeLog | 5 +++++ ld/lexsup.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 596ed9a..cfa2bab 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2001-06-15 H.J. Lu + + * lexsup.c (parse_args); Save optind to report unrecognized + option. + 2001-06-15 Hans-Peter Nilsson * ldlang.c (lang_check): Emit fatal error if relocatable link 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"), -- 2.7.4