autoconf-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Autoconf source repository branch, master, updated. v2.68-113-


From: Stefano Lattarini
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.68-113-g5bc3e85
Date: Sun, 15 Jan 2012 08:18:38 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=5bc3e85e91927fd7fa048a6a53d01abcf9978e6a

The branch, master has been updated
       via  5bc3e85e91927fd7fa048a6a53d01abcf9978e6a (commit)
      from  28fd1f4aa49c1180919a12ba0a793204fc1fcebe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5bc3e85e91927fd7fa048a6a53d01abcf9978e6a
Author: Stefano Lattarini <address@hidden>
Date:   Sat Jan 14 19:04:32 2012 +0100

    getopt: fix diagnostic for missing mandatory option argument
    
    Before this change, an incorrect command line usage:
      "autom4te --output"
    triggered broken diagnostic like:
      "autom4te: unrecognized option `--output'"
    instead of the expected and correct:
      "autom4te: option `--output' requires an argument"
    
    * lib/Autom4te/General.pm (getopt): Give correct diagnostic in
    case of usage errors due to missing arguments for options for
    which they are mandatory.  Code basically copied from automake's
    'parse_arguments' private subroutine.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |   14 ++++++++++++++
 lib/Autom4te/General.pm |   31 +++++++++++++++++++++++++++----
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 69df405..c5ccc04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-14  Stefano Lattarini  <address@hidden>
+
+       getopt: fix diagnostic for missing mandatory option argument
+       Before this change, an incorrect command line usage:
+         "autom4te --output"
+       triggered broken diagnostic like:
+         "autom4te: unrecognized option `--output'"
+       instead of the expected and correct:
+         "autom4te: option `--output' requires an argument"
+       * lib/Autom4te/General.pm (getopt): Give correct diagnostic in
+       case of usage errors due to missing arguments for options for
+       which they are mandatory.  Code basically copied from automake's
+       'parse_arguments' private subroutine.
+
 2012-01-05  Paul Eggert  <address@hidden>
 
        doc: mention Bash 2.03 bug with backslash-newline
diff --git a/lib/Autom4te/General.pm b/lib/Autom4te/General.pm
index f4af4c6..5b48005 100644
--- a/lib/Autom4te/General.pm
+++ b/lib/Autom4te/General.pm
@@ -267,11 +267,34 @@ sub getopt (%)
   GetOptions (%option)
     or exit 1;
 
-  foreach (grep { /^-./ } @ARGV)
+  # FIXME: Lot of code duplication with automake here.  It would probably
+  # be best to generalize our getopt() func and rip it out in a new module
+  # from which automake can sync.
+  if ($ARGV[0] =~ /^-./)
     {
-      print STDERR "$0: unrecognized option `$_'\n";
-      print STDERR "Try `$0 --help' for more information.\n";
-      exit (1);
+      my %argopts;
+      for my $k (keys %option)
+       {
+         if ($k =~ /(.*)=s$/)
+           {
+             map { $argopts{(length ($_) == 1)
+                            ? "-$_" : "--$_" } = 1; } (split (/\|/, $1));
+           }
+       }
+      if ($ARGV[0] eq '--')
+       {
+         shift @ARGV;
+       }
+      elsif (exists $argopts{$ARGV[0]})
+       {
+         fatal ("option `$ARGV[0]' requires an argument\n"
+                . "Try `$0 --help' for more information.");
+       }
+      else
+       {
+         fatal ("unrecognized option `$ARGV[0]'.\n"
+                . "Try `$0 --help' for more information.");
+       }
     }
 
   push @ARGV, '-'


hooks/post-receive
-- 
GNU Autoconf source repository



reply via email to

[Prev in Thread] Current Thread [Next in Thread]