]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Update from gnulib.
authorBruno Haible <bruno@clisp.org>
Sat, 22 Jul 2006 16:38:49 +0000 (16:38 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:41 +0000 (12:13 +0200)
gettext-tools/lib/ChangeLog
gettext-tools/lib/getopt.c
gettext-tools/lib/getopt1.c
gettext-tools/m4/ChangeLog
gettext-tools/m4/getopt.m4
gettext-tools/m4/strtol.m4
gettext-tools/m4/strtoul.m4

index c02af58e73df643fa76f47c6756e6bd5b9b885e6..9d49777f2cc18ff78f7ac395865802383c70f43e 100644 (file)
@@ -16,6 +16,9 @@
        * wcwidth.h: New file, from gnulib.
        * Makefile.am (libgettextlib_la_SOURCES): Add it.
 
+       * getopt.c: Update from gnulib.
+       * getopt1.c: Likewise.
+
        * gcd.c: Update from gnulib.
 
        * fwriteerror.c: Update from gnulib.
index bcb81c83fe25da1e9c01b0a6347f5ce836a68960..f37a837bcf33b8a8e98070906efab1b3d391aba0 100644 (file)
@@ -2,7 +2,7 @@
    NOTE: getopt is now part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to drepper@gnu.org
    before changing it!
-   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
+   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006
        Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 \f
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
-   Ditto for AIX 3.2 and <stdlib.h>.  */
-#ifndef _NO_PROTO
-# define _NO_PROTO
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include <stdio.h>
-
-/* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
-   contain conflicting prototypes for getopt.  */
-# include <stdlib.h>
-# include <unistd.h>
-#endif /* GNU C library.  */
+#include "getopt.h"
 
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
-#ifdef VMS
+#ifdef __VMS
 # include <unixlib.h>
 #endif
 
@@ -76,7 +64,6 @@
    GNU application programs can use a third alternative mode in which
    they can distinguish the relative order of options and other arguments.  */
 
-#include "getopt.h"
 #include "getopt_int.h"
 
 /* For communication from `getopt' to the caller.
@@ -118,16 +105,9 @@ int optopt = '?';
 static struct _getopt_data getopt_data;
 
 \f
-#ifndef __GNU_LIBRARY__
-
-/* Avoid depending on library functions or files
-   whose names are inconsistent.  */
-
-#ifndef getenv
+#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
 extern char *getenv ();
 #endif
-
-#endif /* not __GNU_LIBRARY__ */
 \f
 #ifdef _LIBC
 /* Stored original parameters.
@@ -556,10 +536,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
                  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                 if (_IO_fwide (stderr, 0) > 0)
-                   __fwprintf (stderr, L"%s", buf);
-                 else
-                   fputs (buf, stderr);
+                 __fxprintf (NULL, "%s", buf);
 
                  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                  _IO_funlockfile (stderr);
@@ -634,10 +611,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                          ((_IO_FILE *) stderr)->_flags2
                            |= _IO_FLAGS2_NOTCANCEL;
 
-                         if (_IO_fwide (stderr, 0) > 0)
-                           __fwprintf (stderr, L"%s", buf);
-                         else
-                           fputs (buf, stderr);
+                         __fxprintf (NULL, "%s", buf);
 
                          ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                          _IO_funlockfile (stderr);
@@ -674,10 +648,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                          ((_IO_FILE *) stderr)->_flags2
                            |= _IO_FLAGS2_NOTCANCEL;
 
-                         if (_IO_fwide (stderr, 0) > 0)
-                           __fwprintf (stderr, L"%s", buf);
-                         else
-                           fputs (buf, stderr);
+                         __fxprintf (NULL, "%s", buf);
 
                          ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                          _IO_funlockfile (stderr);
@@ -751,10 +722,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
                  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                 if (_IO_fwide (stderr, 0) > 0)
-                   __fwprintf (stderr, L"%s", buf);
-                 else
-                   fputs (buf, stderr);
+                 __fxprintf (NULL, "%s", buf);
 
                  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                  _IO_funlockfile (stderr);
@@ -817,10 +785,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
                ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-               if (_IO_fwide (stderr, 0) > 0)
-                 __fwprintf (stderr, L"%s", buf);
-               else
-                 fputs (buf, stderr);
+               __fxprintf (NULL, "%s", buf);
 
                ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                _IO_funlockfile (stderr);
@@ -868,10 +833,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
                    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                   if (_IO_fwide (stderr, 0) > 0)
-                     __fwprintf (stderr, L"%s", buf);
-                   else
-                     fputs (buf, stderr);
+                   __fxprintf (NULL, "%s", buf);
 
                    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                    _IO_funlockfile (stderr);
@@ -940,10 +902,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
                    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                   if (_IO_fwide (stderr, 0) > 0)
-                     __fwprintf (stderr, L"%s", buf);
-                   else
-                     fputs (buf, stderr);
+                   __fxprintf (NULL, "%s", buf);
 
                    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                    _IO_funlockfile (stderr);
@@ -985,10 +944,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                            ((_IO_FILE *) stderr)->_flags2
                              |= _IO_FLAGS2_NOTCANCEL;
 
-                           if (_IO_fwide (stderr, 0) > 0)
-                             __fwprintf (stderr, L"%s", buf);
-                           else
-                             fputs (buf, stderr);
+                           __fxprintf (NULL, "%s", buf);
 
                            ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                            _IO_funlockfile (stderr);
@@ -1027,10 +983,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                            ((_IO_FILE *) stderr)->_flags2
                              |= _IO_FLAGS2_NOTCANCEL;
 
-                           if (_IO_fwide (stderr, 0) > 0)
-                             __fwprintf (stderr, L"%s", buf);
-                           else
-                             fputs (buf, stderr);
+                           __fxprintf (NULL, "%s", buf);
 
                            ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                            _IO_funlockfile (stderr);
@@ -1101,10 +1054,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                        int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
                        ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
-                       if (_IO_fwide (stderr, 0) > 0)
-                         __fwprintf (stderr, L"%s", buf);
-                       else
-                         fputs (buf, stderr);
+                       __fxprintf (NULL, "%s", buf);
 
                        ((_IO_FILE *) stderr)->_flags2 = old_flags2;
                        _IO_funlockfile (stderr);
index 5acd2245af0ada261f56af989eb6d444110edf0f..25d792650f7351705012b0aa7608ebe7fa76d075 100644 (file)
@@ -18,7 +18,7 @@
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 \f
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
 #endif
 
 #ifdef _LIBC
index 85f42da9db2554d09aaf079cf0dccddfd4b2548c..1a9dc03a783715ed792ddce09b30612dd3fa0339 100644 (file)
@@ -15,6 +15,8 @@
        * wcwidth.m4: New file, from gnulib.
        * Makefile.am (EXTRA_DIST): Add it.
 
+       * getopt.m4: Update from gnulib.
+
        * fnmatch.m4: Update from gnulib.
 
        * error.m4: Update from gnulib.
index 4d8bd74ab9bf7517ca5fcb6fcdf5b975df8956ef..c0a73b2cb803aeb637f7f2db1b503e5e55b4da14 100644 (file)
@@ -1,42 +1,83 @@
-# getopt.m4 serial 7
-dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# getopt.m4 serial 13
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 # The getopt module assume you want GNU getopt, with getopt_long etc,
-# rather than vanilla POSIX getopt.  This means your your code should
+# rather than vanilla POSIX getopt.  This means your code should
 # always include <getopt.h> for the getopt prototypes.
 
 AC_DEFUN([gl_GETOPT_SUBSTITUTE],
 [
-  GETOPT_H=getopt.h
   AC_LIBOBJ([getopt])
   AC_LIBOBJ([getopt1])
+  gl_GETOPT_SUBSTITUTE_HEADER
+  gl_PREREQ_GETOPT
+])
+
+AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
+[
+  GETOPT_H=getopt.h
   AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
     [Define to rpl_ if the getopt replacement functions and variables
      should be used.])
   AC_SUBST([GETOPT_H])
 ])
 
-AC_DEFUN([gl_GETOPT],
+AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
 [
-  gl_PREREQ_GETOPT
-
   if test -z "$GETOPT_H"; then
-    GETOPT_H=
     AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
+  fi
+
+  if test -z "$GETOPT_H"; then
     AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
+  fi
 
-    dnl BSD getopt_long uses an incompatible method to reset option processing,
-    dnl and (as of 2004-10-15) mishandles optional option-arguments.
+  dnl BSD getopt_long uses an incompatible method to reset option processing,
+  dnl and (as of 2004-10-15) mishandles optional option-arguments.
+  if test -z "$GETOPT_H"; then
     AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
+  fi
 
-    if test -n "$GETOPT_H"; then
-      gl_GETOPT_SUBSTITUTE
+  dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
+  dnl option string (as of 2005-05-05).
+  if test -z "$GETOPT_H"; then
+    AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
+      [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM([#include <getopt.h>],
+          [[
+            char *myargv[3];
+            myargv[0] = "conftest";
+            myargv[1] = "-+";
+            myargv[2] = 0;
+            return getopt (2, myargv, "+a") != '?';
+          ]])],
+       [gl_cv_func_gnu_getopt=yes],
+       [gl_cv_func_gnu_getopt=no],
+       [dnl cross compiling - pessimistically guess based on decls
+        dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
+        dnl option string (as of 2005-05-05).
+        AC_CHECK_DECL([getopt_clip],
+          [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
+          [#include <getopt.h>])])])
+    if test "$gl_cv_func_gnu_getopt" = "no"; then
+      GETOPT_H=getopt.h
     fi
   fi
 ])
 
+AC_DEFUN([gl_GETOPT_IFELSE],
+[
+  AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
+  AS_IF([test -n "$GETOPT_H"], [$1], [$2])
+])
+
+AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
+
 # Prerequisites of lib/getopt*.
-AC_DEFUN([gl_PREREQ_GETOPT], [:])
+AC_DEFUN([gl_PREREQ_GETOPT],
+[
+  AC_CHECK_DECLS_ONCE([getenv])
+])
index b9308ed53b9520c5134fae640569c5844c6484b6..7fbae60eb35cf46cc187c0541b16e406a6d4eccb 100644 (file)
@@ -1,5 +1,5 @@
-# strtol.m4 serial 3
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# strtol.m4 serial 4
+dnl Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -7,13 +7,4 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_STRTOL],
 [
   AC_REPLACE_FUNCS(strtol)
-  if test $ac_cv_func_strtol = no; then
-    gl_PREREQ_STRTOL
-  fi
-])
-
-# Prerequisites of lib/strtol.c.
-AC_DEFUN([gl_PREREQ_STRTOL], [
-  AC_REQUIRE([AC_HEADER_STDC])
-  AC_CHECK_FUNCS_ONCE(isascii)
 ])
index 512cd09a48746dacca7f855a72d9f1ca3f7f4a95..5ec54aa2ee2fbb440bab10f1d60226c811150100 100644 (file)
@@ -1,5 +1,5 @@
-# strtoul.m4 serial 2
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# strtoul.m4 serial 3
+dnl Copyright (C) 2002, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -7,12 +7,4 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_STRTOUL],
 [
   AC_REPLACE_FUNCS(strtoul)
-  if test $ac_cv_func_strtoul = no; then
-    gl_PREREQ_STRTOUL
-  fi
-])
-
-# Prerequisites of lib/strtoul.c.
-AC_DEFUN([gl_PREREQ_STRTOUL], [
-  gl_PREREQ_STRTOL
 ])