From: Akim Demaille Date: Mon, 21 Jan 2002 13:00:52 +0000 (+0000) Subject: * lib/Autom4te/General.pm (getopt): Use a more GNUish error X-Git-Tag: AUTOCONF-2.52g~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3b5a2e1b3312ae511d138ba81e079c3d4cf4e46;p=thirdparty%2Fautoconf.git * lib/Autom4te/General.pm (getopt): Use a more GNUish error message on invalid options. * bin/autom4te.in (parse_args): Don't use Autoconf::General::getopt with non valid options. --- diff --git a/ChangeLog b/ChangeLog index 2dc7ff6e8..a6317d88b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-01-21 Akim Demaille + + * lib/Autom4te/General.pm (getopt): Use a more GNUish error + message on invalid options. + * bin/autom4te.in (parse_args): Don't use + Autoconf::General::getopt with non valid options. + 2002-01-17 Jim Meyering * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Initialize diff --git a/bin/autom4te.in b/bin/autom4te.in index 9a70e6a2f..1b54b3497 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -459,8 +459,9 @@ sub parse_args () my @language; do { @language = (); + use Getopt::Long; Getopt::Long::Configure ("pass_through"); - getopt ("l|language=s" => \@language); + GetOptions ("l|language=s" => \@language); foreach (@language) { @@ -474,7 +475,6 @@ sub parse_args () # Process the arguments for real this time. my @trace; - Getopt::Long::Configure ("defaults"); getopt ( # Operation modes: diff --git a/lib/Autom4te/General.pm b/lib/Autom4te/General.pm index 52cf402a6..7cf43123a 100644 --- a/lib/Autom4te/General.pm +++ b/lib/Autom4te/General.pm @@ -275,18 +275,26 @@ sub getopt (%) # If fixed some day, use this: '' => sub { push @ARGV, "-" } my $stdin = grep /^-$/, @ARGV; @ARGV = grep !/^-$/, @ARGV; - %option = (%option, - "h|help" => sub { print $help; exit 0 }, + %option = ("h|help" => sub { print $help; exit 0 }, "V|version" => sub { print $version; exit 0 }, "v|verbose" => \$verbose, "d|debug" => \$debug, 'f|force' => \$force, - ); - Getopt::Long::Configure ("bundling"); + + # User options last, so that they have precedence. + %option); + Getopt::Long::Configure ("bundling", "pass_through"); GetOptions (%option) or exit 1; + foreach (grep { /^-./ } @ARGV) + { + print STDERR "$0: unrecognized option `$_'\n"; + print STDERR "Try `$0 --help' for more information.\n"; + exit (1); + } + push @ARGV, '-' if $stdin; } diff --git a/man/autom4te.1 b/man/autom4te.1 index ee70108c1..0f98fc3ec 100644 --- a/man/autom4te.1 +++ b/man/autom4te.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.24. -.TH AUTOM4TE "1" "November 2001" "GNU Autoconf 2.52g" FSF +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.25. +.TH AUTOM4TE "1" "January 2002" "autom4te 2.52g" "User Commands" .SH NAME autom4te \- Generate files and scripts thanks to M4 .SH SYNOPSIS