gss-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gss branch, master, updated. gss-1-0-0-7-g229a8a4


From: Simon Josefsson
Subject: [SCM] GNU gss branch, master, updated. gss-1-0-0-7-g229a8a4
Date: Thu, 22 Apr 2010 07:21:04 +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 gss".

http://git.savannah.gnu.org/cgit/gss.git/commit/?id=229a8a4e5fb7e2c0522b7aff01f24473a424261f

The branch, master has been updated
       via  229a8a4e5fb7e2c0522b7aff01f24473a424261f (commit)
      from  a1e4b4e7f4dd3899c1b11d71d1dc6ec909a85536 (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 229a8a4e5fb7e2c0522b7aff01f24473a424261f
Author: Simon Josefsson <address@hidden>
Date:   Thu Apr 22 09:21:00 2010 +0200

    Update gnulib files.

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

Summary of changes:
 maint.mk            |   27 +++++++++++---------
 src/gl/getopt.c     |   39 +++++++++++++++++------------
 src/gl/getopt_int.h |   69 ++++++++++++++++++++++++++------------------------
 src/gl/m4/getopt.m4 |   41 +++++++++++++++++++++++++++---
 4 files changed, 111 insertions(+), 65 deletions(-)

diff --git a/maint.mk b/maint.mk
index 6942730..f646e43 100644
--- a/maint.mk
+++ b/maint.mk
@@ -660,9 +660,10 @@ sc_GFDL_version:
          $(_sc_search_regexp)
 
 # Don't use Texinfo @acronym{} as it is not a good idea.
+texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$
 sc_texinfo_acronym:
-       @prohibit='@acronym{'                                           \
-       in_vc_files='\.texi$$'                                          \
+       @prohibit='@acronym\{'                                          \
+       in_vc_files='$(texinfo_suffix_re_)'                             \
        halt='found use of Texinfo @acronym{}'                          \
          $(_sc_search_regexp)
 
@@ -693,16 +694,18 @@ sc_prohibit_cvs_keyword:
 #   perl -pi -0777 -e 's/\n\n+$/\n/' files...
 #
 detect_empty_lines_at_EOF_ =                                           \
-  foreach my $$f (@ARGV) {                                             \
-    open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next;      \
-    my $$p = sysseek (F, -2, 2);                                       \
-    my $$c = "seek failure probably means file has < 2 bytes; ignore"; \
-    my $$two;                                                          \
-    defined $$p and $$p = sysread F, $$two, 2;                         \
-    close F;                                                           \
-    $$c = "ignore read failure";                                       \
-    $$p && $$two eq "\n\n" and (print $$f), $$fail=1;                  \
-    } END { exit defined $$fail }
+  foreach my $$f (@ARGV)                                               \
+    {                                                                  \
+      open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next;    \
+      my $$p = sysseek (F, -2, 2);                                     \
+      my $$c = "seek failure probably means file has < 2 bytes; ignore"; \
+      my $$last_two_bytes;                                             \
+      defined $$p and $$p = sysread F, $$last_two_bytes, 2;            \
+      close F;                                                         \
+      $$c = "ignore read failure";                                     \
+      $$p && $$last_two_bytes eq "\n\n" and (print $$f), $$fail=1;     \
+    }                                                                  \
+  END { exit defined $$fail }
 sc_prohibit_empty_lines_at_EOF:
        @perl -le '$(detect_empty_lines_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
           || { echo '$(ME): the above files end with empty line(s)'     \
diff --git a/src/gl/getopt.c b/src/gl/getopt.c
index aaabc8d..3791f12 100644
--- a/src/gl/getopt.c
+++ b/src/gl/getopt.c
@@ -348,8 +348,6 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                     int long_only, struct _getopt_data *d, int posixly_correct)
 {
   int print_errors = d->opterr;
-  if (optstring[0] == ':')
-    print_errors = 0;
 
   if (argc < 1)
     return -1;
@@ -364,6 +362,10 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                                       posixly_correct);
       d->__initialized = 1;
     }
+  else if (optstring[0] == '-' || optstring[0] == '+')
+    optstring++;
+  if (optstring[0] == ':')
+    print_errors = 0;
 
   /* Test whether ARGV[optind] points to a non-option argument.
      Either it does not have option syntax, or there is an environment flag
@@ -633,8 +635,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                       char *buf;
 
                       if (__asprintf (&buf, _("\
-%s: option '%s' requires an argument\n"),
-                                      argv[0], argv[d->optind - 1]) >= 0)
+%s: option '--%s' requires an argument\n"),
+                                      argv[0], pfound->name) >= 0)
                         {
                           _IO_flockfile (stderr);
 
@@ -651,8 +653,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                         }
 #else
                       fprintf (stderr,
-                               _("%s: option '%s' requires an argument\n"),
-                               argv[0], argv[d->optind - 1]);
+                               _("%s: option '--%s' requires an argument\n"),
+                               argv[0], pfound->name);
 #endif
                     }
                   d->__nextchar += strlen (d->__nextchar);
@@ -736,13 +738,13 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
 
   {
     char c = *d->__nextchar++;
-    char *temp = strchr (optstring, c);
+    const char *temp = strchr (optstring, c);
 
     /* Increment `optind' when we start to process its last character.  */
     if (*d->__nextchar == '\0')
       ++d->optind;
 
-    if (temp == NULL || c == ':')
+    if (temp == NULL || c == ':' || c == ';')
       {
         if (print_errors)
           {
@@ -864,7 +866,10 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                   pfound = p;
                   indfound = option_index;
                 }
-              else
+              else if (long_only
+                       || pfound->has_arg != p->has_arg
+                       || pfound->flag != p->flag
+                       || pfound->val != p->val)
                 /* Second or later nonexact match found.  */
                 ambig = 1;
             }
@@ -876,7 +881,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                 char *buf;
 
                 if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
-                                argv[0], argv[d->optind]) >= 0)
+                                argv[0], d->optarg) >= 0)
                   {
                     _IO_flockfile (stderr);
 
@@ -892,7 +897,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                   }
 #else
                 fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"),
-                         argv[0], argv[d->optind]);
+                         argv[0], d->optarg);
 #endif
               }
             d->__nextchar += strlen (d->__nextchar);
@@ -955,8 +960,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                         char *buf;
 
                         if (__asprintf (&buf, _("\
-%s: option '%s' requires an argument\n"),
-                                        argv[0], argv[d->optind - 1]) >= 0)
+%s: option '-W %s' requires an argument\n"),
+                                        argv[0], pfound->name) >= 0)
                           {
                             _IO_flockfile (stderr);
 
@@ -972,15 +977,17 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                             free (buf);
                           }
 #else
-                        fprintf (stderr,
-                                 _("%s: option '%s' requires an argument\n"),
-                                 argv[0], argv[d->optind - 1]);
+                        fprintf (stderr, _("\
+%s: option '-W %s' requires an argument\n"),
+                                 argv[0], pfound->name);
 #endif
                       }
                     d->__nextchar += strlen (d->__nextchar);
                     return optstring[0] == ':' ? ':' : '?';
                   }
               }
+            else
+              d->optarg = NULL;
             d->__nextchar += strlen (d->__nextchar);
             if (longind != NULL)
               *longind = option_index;
diff --git a/src/gl/getopt_int.h b/src/gl/getopt_int.h
index 169def5..980b750 100644
--- a/src/gl/getopt_int.h
+++ b/src/gl/getopt_int.h
@@ -30,6 +30,40 @@ extern int _getopt_internal (int ___argc, char **___argv,
 /* Reentrant versions which can handle parsing multiple argument
    vectors at the same time.  */
 
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters, or by calling getopt.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we
+   scan, so that eventually all the non-options are at the end.
+   This allows options to be given in any order, even with programs
+   that were not written to expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were
+   written to expect options and other ARGV-elements in any order
+   and that care about the ordering of the two.  We describe each
+   non-option ARGV-element as if it were the argument of an option
+   with character code 1.  Using `-' as the first character of the
+   list of option characters selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+
+enum __ord
+  {
+    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+  };
+
 /* Data type for reentrant functions.  */
 struct _getopt_data
 {
@@ -54,39 +88,8 @@ struct _getopt_data
      by advancing to the next ARGV-element.  */
   char *__nextchar;
 
-  /* Describe how to deal with options that follow non-option ARGV-elements.
-
-     If the caller did not specify anything,
-     the default is REQUIRE_ORDER if the environment variable
-     POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
-     REQUIRE_ORDER means don't recognize them as options;
-     stop option processing when the first non-option is seen.
-     This is what Unix does.
-     This mode of operation is selected by either setting the environment
-     variable POSIXLY_CORRECT, or using `+' as the first character
-     of the list of option characters, or by calling getopt.
-
-     PERMUTE is the default.  We permute the contents of ARGV as we
-     scan, so that eventually all the non-options are at the end.
-     This allows options to be given in any order, even with programs
-     that were not written to expect this.
-
-     RETURN_IN_ORDER is an option available to programs that were
-     written to expect options and other ARGV-elements in any order
-     and that care about the ordering of the two.  We describe each
-     non-option ARGV-element as if it were the argument of an option
-     with character code 1.  Using `-' as the first character of the
-     list of option characters selects this mode of operation.
-
-     The special argument `--' forces an end of option-scanning regardless
-     of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
-     `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
-
-  enum
-    {
-      REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-    } __ordering;
+  /* See __ord above.  */
+  enum __ord __ordering;
 
   /* If the POSIXLY_CORRECT environment variable is set
      or getopt was called.  */
diff --git a/src/gl/m4/getopt.m4 b/src/gl/m4/getopt.m4
index a19805e..5b211e5 100644
--- a/src/gl/m4/getopt.m4
+++ b/src/gl/m4/getopt.m4
@@ -1,4 +1,4 @@
-# getopt.m4 serial 24
+# getopt.m4 serial 28
 dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -79,8 +79,13 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
   dnl Existence of the variable, in and of itself, is not a reason to replace
   dnl getopt, but knowledge of the variable is needed to determine how to
   dnl reset and whether a reset reparses the environment.
-  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
-    AC_CHECK_DECLS([optreset], [], [],
+  dnl Solaris supports neither optreset nor optind=0, but keeps no state that
+  dnl needs a reset beyond setting optind=1; detect Solaris by getopt_clip.
+  if test -z "$gl_replace_getopt"; then
+    AC_CHECK_DECLS([optreset], [],
+      [AC_CHECK_DECLS([getopt_clip], [], [],
+        [[#include <getopt.h>]])
+      ],
       [[#include <getopt.h>]])
   fi
 
@@ -89,6 +94,10 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
   dnl is left over from earlier calls, and neither setting optind = 0 nor
   dnl setting optreset = 1 get rid of this internal state.
   dnl POSIX is silent on optind vs. optreset, so we allow either behavior.
+  dnl POSIX 2008 does not specify leading '+' behavior, but see
+  dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on
+  dnl the next version of POSIX.  For now, we only guarantee leading '+'
+  dnl behavior with getopt-gnu.
   if test -z "$gl_replace_getopt"; then
     AC_CACHE_CHECK([whether getopt is POSIX compatible],
       [gl_cv_func_getopt_posix],
@@ -99,7 +108,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
 #include <stdlib.h>
 #include <string.h>
 
-#if !HAVE_DECL_OPTRESET
+#if !HAVE_DECL_OPTRESET && !HAVE_DECL_GETOPT_CLIP
 # define OPTIND_MIN 0
 #else
 # define OPTIND_MIN 1
@@ -167,6 +176,20 @@ main ()
     if (!(optind == 1))
       return 12;
   }
+  /* Detect MacOS 10.5 bug.  */
+  {
+    char *argv[3] = { "program", "-ab", NULL };
+    optind = OPTIND_MIN;
+    opterr = 0;
+    if (getopt (2, argv, "ab:") != 'a')
+      return 13;
+    if (getopt (2, argv, "ab:") != '?')
+      return 14;
+    if (optopt != 'b')
+      return 15;
+    if (optind != 2)
+      return 16;
+  }
 
   return 0;
 }
@@ -174,6 +197,7 @@ main ()
           [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no],
           [case "$host_os" in
              mingw*) gl_cv_func_getopt_posix="guessing no";;
+             darwin*) gl_cv_func_getopt_posix="guessing no";;
              *)      gl_cv_func_getopt_posix="guessing yes";;
            esac
           ])
@@ -234,6 +258,15 @@ main ()
                if (getopt (3, argv, "-p") != 'p')
                  return 7;
              }
+             /* This code fails on glibc 2.11.  */
+             {
+               char *argv[] = { "program", "-b", "-a", NULL };
+               optind = opterr = 0;
+               if (getopt (3, argv, "+:a:b") != 'b')
+                 return 8;
+               if (getopt (3, argv, "+:a:b") != ':')
+                 return 9;
+             }
              return 0;
            ]])],
         [gl_cv_func_getopt_gnu=yes],


hooks/post-receive
-- 
GNU gss




reply via email to

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