diff options
author | Simon Josefsson <simon@josefsson.org> | 2007-10-22 08:35:09 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2007-10-22 08:35:09 +0200 |
commit | 4d59ff82f4a40333df0562de340ec2b995b1f31c (patch) | |
tree | 3dc271245c107926fd907b96fe9cea640876d1c8 /lgl | |
parent | ead3e58c4189b6c407ab723aa8208df766edcf7a (diff) | |
download | gnutls-4d59ff82f4a40333df0562de340ec2b995b1f31c.tar.gz |
Update gnulib files.
Diffstat (limited to 'lgl')
-rw-r--r-- | lgl/Makefile.am | 79 | ||||
-rw-r--r-- | lgl/alloca.in.h (renamed from lgl/alloca_.h) | 0 | ||||
-rw-r--r-- | lgl/dummy.c | 10 | ||||
-rw-r--r-- | lgl/float.in.h (renamed from lgl/float_.h) | 9 | ||||
-rw-r--r-- | lgl/gc-gnulib.c | 2 | ||||
-rw-r--r-- | lgl/gc-libgcrypt.c | 10 | ||||
-rw-r--r-- | lgl/gc.h | 4 | ||||
-rw-r--r-- | lgl/m4/extensions.m4 | 52 | ||||
-rw-r--r-- | lgl/m4/gnulib-comp.m4 | 53 | ||||
-rw-r--r-- | lgl/m4/lock.m4 | 11 | ||||
-rw-r--r-- | lgl/m4/longlong.m4 | 13 | ||||
-rw-r--r-- | lgl/m4/memmem.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/socklen.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/stdint.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/stdio_h.m4 | 6 | ||||
-rw-r--r-- | lgl/m4/string_h.m4 | 3 | ||||
-rw-r--r-- | lgl/m4/strverscmp.m4 | 6 | ||||
-rw-r--r-- | lgl/m4/ulonglong.m4 | 13 | ||||
-rw-r--r-- | lgl/m4/vasprintf.m4 | 4 | ||||
-rw-r--r-- | lgl/printf-parse.c | 2 | ||||
-rw-r--r-- | lgl/realloc.c | 9 | ||||
-rw-r--r-- | lgl/stdbool.in.h (renamed from lgl/stdbool_.h) | 0 | ||||
-rw-r--r-- | lgl/stdint.in.h (renamed from lgl/stdint_.h) | 0 | ||||
-rw-r--r-- | lgl/stdio.in.h (renamed from lgl/stdio_.h) | 53 | ||||
-rw-r--r-- | lgl/stdlib.in.h (renamed from lgl/stdlib_.h) | 9 | ||||
-rw-r--r-- | lgl/string.in.h (renamed from lgl/string_.h) | 15 | ||||
-rw-r--r-- | lgl/sys_socket.in.h (renamed from lgl/sys_socket_.h) | 0 | ||||
-rw-r--r-- | lgl/sys_stat.in.h (renamed from lgl/sys_stat_.h) | 0 | ||||
-rw-r--r-- | lgl/time.in.h (renamed from lgl/time_.h) | 0 | ||||
-rw-r--r-- | lgl/unistd.in.h (renamed from lgl/unistd_.h) | 0 | ||||
-rw-r--r-- | lgl/vasnprintf.c | 45 | ||||
-rw-r--r-- | lgl/wchar.in.h (renamed from lgl/wchar_.h) | 0 |
32 files changed, 266 insertions, 154 deletions
diff --git a/lgl/Makefile.am b/lgl/Makefile.am index 703701a48a..ca8f208d6a 100644 --- a/lgl/Makefile.am +++ b/lgl/Makefile.am @@ -50,14 +50,14 @@ BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create <alloca.h> when the system # doesn't have one that works with the given compiler. -alloca.h: alloca_.h +alloca.h: alloca.in.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/alloca_.h; \ + cat $(srcdir)/alloca.in.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t -EXTRA_DIST += alloca_.h +EXTRA_DIST += alloca.in.h ## end gnulib module alloca-opt @@ -179,17 +179,17 @@ BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. -float.h: float_.h +float.h: float.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ - < $(srcdir)/float_.h; \ + < $(srcdir)/float.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += float.h float.h-t -EXTRA_DIST += float_.h +EXTRA_DIST += float.in.h ## end gnulib module float @@ -293,15 +293,15 @@ BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create <stdbool.h> when the system # doesn't have one that works. -stdbool.h: stdbool_.h +stdbool.h: stdbool.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t -EXTRA_DIST += stdbool_.h +EXTRA_DIST += stdbool.in.h ## end gnulib module stdbool @@ -311,7 +311,7 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create <stdint.h> when the system # doesn't have one that works with the given compiler. -stdint.h: stdint_.h +stdint.h: stdint.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ @@ -336,12 +336,12 @@ stdint.h: stdint_.h -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ - < $(srcdir)/stdint_.h; \ + < $(srcdir)/stdint.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdint.h stdint.h-t -EXTRA_DIST += stdint_.h +EXTRA_DIST += stdint.in.h ## end gnulib module stdint @@ -351,7 +351,7 @@ BUILT_SOURCES += stdio.h # We need the following in order to create <stdio.h> when the system # doesn't have one that works with the given compiler. -stdio.h: stdio_.h +stdio.h: stdio.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -365,6 +365,8 @@ stdio.h: stdio_.h -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ + -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ + -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ @@ -384,6 +386,8 @@ stdio.h: stdio_.h -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ + -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ @@ -393,12 +397,12 @@ stdio.h: stdio_.h -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdio_.h; \ + < $(srcdir)/stdio.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdio.h stdio.h-t -EXTRA_DIST += stdio_.h +EXTRA_DIST += stdio.in.h ## end gnulib module stdio @@ -408,7 +412,7 @@ BUILT_SOURCES += stdlib.h # We need the following in order to create <stdlib.h> when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib_.h +stdlib.h: stdlib.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -426,12 +430,12 @@ stdlib.h: stdlib_.h -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdlib_.h; \ + < $(srcdir)/stdlib.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t -EXTRA_DIST += stdlib_.h +EXTRA_DIST += stdlib.in.h ## end gnulib module stdlib @@ -441,7 +445,7 @@ BUILT_SOURCES += string.h # We need the following in order to create <string.h> when the system # doesn't have one that works with the given compiler. -string.h: string_.h +string.h: string.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -473,6 +477,7 @@ string.h: string_.h -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ + -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ @@ -489,13 +494,15 @@ string.h: string_.h -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/string_.h; \ + < $(srcdir)/string.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += string.h string.h-t -EXTRA_DIST += string_.h +EXTRA_DIST += string.in.h ## end gnulib module string @@ -514,7 +521,7 @@ BUILT_SOURCES += $(SYS_SOCKET_H) # We need the following in order to create <sys/socket.h> when the system # doesn't have one that works with the given compiler. -sys/socket.h: sys_socket_.h +sys/socket.h: sys_socket.in.h @MKDIR_P@ sys { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -522,13 +529,13 @@ sys/socket.h: sys_socket_.h -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ - < $(srcdir)/sys_socket_.h; \ + < $(srcdir)/sys_socket.in.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t MOSTLYCLEANDIRS += sys -EXTRA_DIST += sys_socket_.h +EXTRA_DIST += sys_socket.in.h ## end gnulib module sys_socket @@ -538,7 +545,7 @@ BUILT_SOURCES += $(SYS_STAT_H) # We need the following in order to create <sys/stat.h> when the system # has one that is incomplete. -sys/stat.h: sys_stat_.h +sys/stat.h: sys_stat.in.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -547,13 +554,13 @@ sys/stat.h: sys_stat_.h -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \ - < $(srcdir)/sys_stat_.h; \ + < $(srcdir)/sys_stat.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t MOSTLYCLEANDIRS += sys -EXTRA_DIST += sys_stat_.h +EXTRA_DIST += sys_stat.in.h ## end gnulib module sys_stat @@ -563,7 +570,7 @@ BUILT_SOURCES += time.h # We need the following in order to create <time.h> when the system # doesn't have one that works with the given compiler. -time.h: time_.h +time.h: time.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -574,12 +581,12 @@ time.h: time_.h -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ -e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ - < $(srcdir)/time_.h; \ + < $(srcdir)/time.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += time.h time.h-t -EXTRA_DIST += time_.h +EXTRA_DIST += time.in.h ## end gnulib module time @@ -598,7 +605,7 @@ BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # <unistd.h> when the system doesn't have one. -unistd.h: unistd_.h +unistd.h: unistd.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ @@ -624,12 +631,12 @@ unistd.h: unistd_.h -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ - < $(srcdir)/unistd_.h; \ + < $(srcdir)/unistd.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += unistd.h unistd.h-t -EXTRA_DIST += unistd_.h +EXTRA_DIST += unistd.in.h ## end gnulib module unistd @@ -657,7 +664,7 @@ BUILT_SOURCES += $(WCHAR_H) # We need the following in order to create <wchar.h> when the system # version does not work standalone. -wchar.h: wchar_.h +wchar.h: wchar.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -667,12 +674,12 @@ wchar.h: wchar_.h -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/wchar_.h; \ + < $(srcdir)/wchar.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t -EXTRA_DIST += wchar_.h +EXTRA_DIST += wchar.in.h ## end gnulib module wchar diff --git a/lgl/alloca_.h b/lgl/alloca.in.h index 1c1d9e68ed..1c1d9e68ed 100644 --- a/lgl/alloca_.h +++ b/lgl/alloca.in.h diff --git a/lgl/dummy.c b/lgl/dummy.c index 42a82de177..5834053b05 100644 --- a/lgl/dummy.c +++ b/lgl/dummy.c @@ -1,10 +1,10 @@ /* A dummy file, to prevent empty libraries from breaking builds. Copyright (C) 2004, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,9 +12,7 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Some systems, reportedly OpenBSD and Mac OS X, refuse to create libraries without any object files. You might get an error like: diff --git a/lgl/float_.h b/lgl/float.in.h index c31f193d03..7cf07915fa 100644 --- a/lgl/float_.h +++ b/lgl/float.in.h @@ -2,10 +2,10 @@ Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,8 +13,7 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_FLOAT_H diff --git a/lgl/gc-gnulib.c b/lgl/gc-gnulib.c index c3cf0c529e..c199833774 100644 --- a/lgl/gc-gnulib.c +++ b/lgl/gc-gnulib.c @@ -581,6 +581,8 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) Gc_rc rc = GC_OK; ctx = calloc (sizeof (*ctx), 1); + if (!ctx) + return GC_MALLOC_ERROR; ctx->alg = hash; ctx->mode = mode; diff --git a/lgl/gc-libgcrypt.c b/lgl/gc-libgcrypt.c index f28a20f9f9..683c73ffb4 100644 --- a/lgl/gc-libgcrypt.c +++ b/lgl/gc-libgcrypt.c @@ -142,16 +142,6 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode, gcryalg = GCRY_CIPHER_RFC2268_40; break; -#ifdef ENABLE_CAMELLIA - case GC_CAMELLIA128: - gcryalg = GCRY_CIPHER_CAMELLIA128; - break; - - case GC_CAMELLIA256: - gcryalg = GCRY_CIPHER_CAMELLIA256; - break; -#endif - default: return GC_INVALID_CIPHER; } @@ -79,9 +79,7 @@ enum Gc_cipher GC_DES, GC_ARCFOUR128, GC_ARCFOUR40, - GC_ARCTWO40, - GC_CAMELLIA128, - GC_CAMELLIA256 + GC_ARCTWO40 }; typedef enum Gc_cipher Gc_cipher; diff --git a/lgl/m4/extensions.m4 b/lgl/m4/extensions.m4 index 143a9e5403..bcbb3ceee2 100644 --- a/lgl/m4/extensions.m4 +++ b/lgl/m4/extensions.m4 @@ -1,14 +1,14 @@ -# serial 4 -*- Autoconf -*- +# serial 5 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -16,26 +16,48 @@ # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. +# Remember that #undef in AH_VERBATIM gets replaced with #define by +# AC_DEFINE. The goal here is to define all known feature-enabling +# macros, then, if reports of conflicts are made, disable macros that +# cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], -[ - AC_BEFORE([$0], [AC_COMPILE_IFELSE]) - AC_BEFORE([$0], [AC_RUN_IFELSE]) +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - AC_REQUIRE([AC_GNU_SOURCE]) - AC_REQUIRE([AC_AIX]) - AC_REQUIRE([AC_MINIX]) + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) + if test "$MINIX" = yes; then + AC_DEFINE([_POSIX_SOURCE], [1], + [Define to 1 if you need to in order for `stat' and other + things to work.]) + AC_DEFINE([_POSIX_1_SOURCE], [2], + [Define to 2 if the system does not provide POSIX.1 features + except with this defined.]) + AC_DEFINE([_MINIX], [1], + [Define to 1 if on MINIX.]) + fi AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE #endif +/* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE -#endif]) +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +]) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( @@ -46,9 +68,11 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) -]) +])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS # ------------------------ diff --git a/lgl/m4/gnulib-comp.m4 b/lgl/m4/gnulib-comp.m4 index 10e3e26fe8..55c46f19cc 100644 --- a/lgl/m4/gnulib-comp.m4 +++ b/lgl/m4/gnulib-comp.m4 @@ -124,25 +124,38 @@ AC_DEFUN([lgl_INIT], # Like AC_LIBOBJ, except that the module name goes # into lgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgl_LIBOBJ], - [lgl_LIBOBJS="$lgl_LIBOBJS $1.$ac_objext"]) +AC_DEFUN([lgl_LIBOBJ], [ + AS_LITERAL_IF([$1], [lgl_LIBSOURCES([$1.c])])dnl + lgl_LIBOBJS="$lgl_LIBOBJS $1.$ac_objext" +]) # Like AC_REPLACE_FUNCS, except that the module name goes # into lgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgl_REPLACE_FUNCS], - [AC_CHECK_FUNCS([$1], , [lgl_LIBOBJ($ac_func)])]) +AC_DEFUN([lgl_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [lgl_LIBOBJ($ac_func)]) +]) -# Like AC_LIBSOURCES, except that it does nothing. -# We rely on EXTRA_lib..._SOURCES instead. -AC_DEFUN([lgl_LIBSOURCES], - []) +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parametrization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([lgl_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_syscmd([test -r lgl/]_gl_NAME[ || test ! -d lgl])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([missing lgl/]_gl_NAME)]) + ]) + ]) +]) # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([lgl_FILE_LIST], [ build-aux/config.rpath build-aux/link-warning.h - lib/alloca_.h + lib/alloca.in.h lib/arcfour.c lib/arcfour.h lib/arctwo.c @@ -153,7 +166,7 @@ AC_DEFUN([lgl_FILE_LIST], [ lib/des.h lib/dummy.c lib/float+.h - lib/float_.h + lib/float.in.h lib/gc-gnulib.c lib/gc-libgcrypt.c lib/gc-pbkdf2-sha1.c @@ -188,22 +201,22 @@ AC_DEFUN([lgl_FILE_LIST], [ lib/sha1.h lib/size_max.h lib/snprintf.c - lib/stdbool_.h - lib/stdint_.h - lib/stdio_.h - lib/stdlib_.h - lib/string_.h + lib/stdbool.in.h + lib/stdint.in.h + lib/stdio.in.h + lib/stdlib.in.h + lib/string.in.h lib/strverscmp.c lib/strverscmp.h - lib/sys_socket_.h - lib/sys_stat_.h - lib/time_.h + lib/sys_socket.in.h + lib/sys_stat.in.h + lib/time.in.h lib/time_r.c - lib/unistd_.h + lib/unistd.in.h lib/vasnprintf.c lib/vasnprintf.h lib/vasprintf.c - lib/wchar_.h + lib/wchar.in.h lib/xsize.h m4/absolute-header.m4 m4/alloca.m4 diff --git a/lgl/m4/lock.m4 b/lgl/m4/lock.m4 index 0224f2ff87..4cc585ea2e 100644 --- a/lgl/m4/lock.m4 +++ b/lgl/m4/lock.m4 @@ -1,5 +1,5 @@ -# lock.m4 serial 6 (gettext-0.16) -dnl Copyright (C) 2005-2006 Free Software Foundation, Inc. +# lock.m4 serial 7 (gettext-0.16.2) +dnl Copyright (C) 2005-2007 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. @@ -35,7 +35,12 @@ AC_DEFUN([gl_LOCK_EARLY_BODY], AC_BEFORE([$0], [gl_ARGP])dnl AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems + dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. + dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes + dnl AC_GNU_SOURCE. + m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], + [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) diff --git a/lgl/m4/longlong.m4 b/lgl/m4/longlong.m4 index 1f9e862ef1..5799c3965a 100644 --- a/lgl/m4/longlong.m4 +++ b/lgl/m4/longlong.m4 @@ -1,5 +1,5 @@ -# longlong.m4 serial 10 -dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. +# longlong.m4 serial 11 +dnl Copyright (C) 1999-2007 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,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be @@ -19,7 +19,10 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[long long int ll = 9223372036854775807ll; + [[#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + error in preprocessor; + #endif + long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) diff --git a/lgl/m4/memmem.m4 b/lgl/m4/memmem.m4 index e6d40068e4..e6a3da193c 100644 --- a/lgl/m4/memmem.m4 +++ b/lgl/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 4 +# memmem.m4 serial 5 dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMMEM], [ dnl Persuade glibc <string.h> to declare memmem(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REPLACE_FUNCS(memmem) diff --git a/lgl/m4/socklen.m4 b/lgl/m4/socklen.m4 index d39a314e17..b755757be4 100644 --- a/lgl/m4/socklen.m4 +++ b/lgl/m4/socklen.m4 @@ -1,4 +1,4 @@ -# socklen.m4 serial 5 +# socklen.m4 serial 6 dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ dnl types for the argument to getsockopt, getpeername, etc. So we dnl have to test to find something that will work. dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find -dnl it there first. That file is included by gnulib's sys_socket_.h, which +dnl it there first. That file is included by gnulib's sys_socket.in.h, which dnl all users of this module should include. Cygwin must not include dnl ws2tcpip.h. AC_DEFUN([gl_TYPE_SOCKLEN_T], diff --git a/lgl/m4/stdint.m4 b/lgl/m4/stdint.m4 index 03bb093202..bb6c34fe1e 100644 --- a/lgl/m4/stdint.m4 +++ b/lgl/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 28 +# stdint.m4 serial 29 dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -370,7 +370,7 @@ AC_DEFUN([gl_STDINT_INCLUDES], dnl gl_STDINT_TYPE_PROPERTIES dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t -dnl of interest to stdint_.h. +dnl of interest to stdint.in.h. AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], [ gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], diff --git a/lgl/m4/stdio_h.m4 b/lgl/m4/stdio_h.m4 index b9a69984f6..45e54e2a62 100644 --- a/lgl/m4/stdio_h.m4 +++ b/lgl/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 7 +# stdio_h.m4 serial 8 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,6 +28,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) + GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) @@ -48,6 +50,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) + REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) + REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) diff --git a/lgl/m4/string_h.m4 b/lgl/m4/string_h.m4 index ec51e9a018..d811e26b88 100644 --- a/lgl/m4/string_h.m4 +++ b/lgl/m4/string_h.m4 @@ -57,6 +57,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) + GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) @@ -74,4 +75,6 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) ]) diff --git a/lgl/m4/strverscmp.m4 b/lgl/m4/strverscmp.m4 index ab20c1809d..5f01ba9e5b 100644 --- a/lgl/m4/strverscmp.m4 +++ b/lgl/m4/strverscmp.m4 @@ -1,5 +1,5 @@ -# strverscmp.m4 serial 4 -dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. +# strverscmp.m4 serial 5 +dnl Copyright (C) 2002, 2005, 2006, 2007 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,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRVERSCMP], [ dnl Persuade glibc <string.h> to declare strverscmp(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REPLACE_FUNCS(strverscmp) if test $ac_cv_func_strverscmp = no; then diff --git a/lgl/m4/ulonglong.m4 b/lgl/m4/ulonglong.m4 index 9fae98e3a6..e9807895a7 100644 --- a/lgl/m4/ulonglong.m4 +++ b/lgl/m4/ulonglong.m4 @@ -1,5 +1,5 @@ -# ulonglong.m4 serial 6 -dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. +# ulonglong.m4 serial 7 +dnl Copyright (C) 1999-2007 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,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. # Note: If the type 'unsigned long long int' exists but is only 32 bits # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT @@ -21,7 +21,10 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ac_cv_type_unsigned_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[unsigned long long int ull = 18446744073709551615ULL; + [[#if ! (18446744073709551615ULL <= -1u) + error in preprocessor; + #endif + unsigned long long int ull = 18446744073709551615ULL; typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; int i = 63;]], diff --git a/lgl/m4/vasprintf.m4 b/lgl/m4/vasprintf.m4 index 4f0c79a71a..074b03cf72 100644 --- a/lgl/m4/vasprintf.m4 +++ b/lgl/m4/vasprintf.m4 @@ -1,4 +1,4 @@ -# vasprintf.m4 serial 5 +# vasprintf.m4 serial 6 dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,7 +31,7 @@ AC_DEFUN([gl_REPLACE_VASPRINTF], AC_DEFUN([gl_PREREQ_VASPRINTF_H], [ dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ]) # Prerequisites of lib/vasprintf.c. diff --git a/lgl/printf-parse.c b/lgl/printf-parse.c index 1c3e6c0a11..0b75c2860d 100644 --- a/lgl/printf-parse.c +++ b/lgl/printf-parse.c @@ -49,7 +49,7 @@ #include <stddef.h> /* Get intmax_t. */ -#ifdef IN_LIBINTL +#if defined IN_LIBINTL || defined IN_LIBASPRINTF # if HAVE_STDINT_H_WITH_UINTMAX # include <stdint.h> # endif diff --git a/lgl/realloc.c b/lgl/realloc.c index bcb6969ec5..4f6cddf537 100644 --- a/lgl/realloc.c +++ b/lgl/realloc.c @@ -2,10 +2,10 @@ Copyright (C) 1997, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,8 +13,7 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* written by Jim Meyering and Bruno Haible */ diff --git a/lgl/stdbool_.h b/lgl/stdbool.in.h index 4762a5c301..4762a5c301 100644 --- a/lgl/stdbool_.h +++ b/lgl/stdbool.in.h diff --git a/lgl/stdint_.h b/lgl/stdint.in.h index 163378ce7d..163378ce7d 100644 --- a/lgl/stdint_.h +++ b/lgl/stdint.in.h diff --git a/lgl/stdio_.h b/lgl/stdio.in.h index 42bac02bdb..b17642438d 100644 --- a/lgl/stdio_.h +++ b/lgl/stdio.in.h @@ -212,6 +212,32 @@ extern int vsprintf (char *str, const char *format, va_list args) # endif #endif +#if @GNULIB_FOPEN@ +# if @REPLACE_FOPEN@ +# define fopen rpl_fopen +extern FILE * fopen (const char *filename, const char *mode); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fopen +# define fopen(f,m) \ + (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \ + "use gnulib module fopen for portability"), \ + fopen (f, m)) +#endif + +#if @GNULIB_FREOPEN@ +# if @REPLACE_FREOPEN@ +# define freopen rpl_freopen +extern FILE * freopen (const char *filename, const char *mode, FILE *stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef freopen +# define freopen(f,m,s) \ + (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \ + "use gnulib module freopen for portability"), \ + freopen (f, m, s)) +#endif + #if @GNULIB_FSEEKO@ # if @REPLACE_FSEEKO@ /* Provide fseek, fseeko functions that are aware of a preceding @@ -308,12 +334,14 @@ extern long rpl_ftell (FILE *fp); #if @GNULIB_GETDELIM@ # if !@HAVE_DECL_GETDELIM@ - /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and - NUL-terminate it). *LINEPTR is a pointer returned from malloc (or - NULL), pointing to *N characters of space. It is realloc'ed as - necessary. Returns the number of characters read (not including - the null terminator), or -1 on error or EOF. */ - extern ssize_t getdelim (char **, size_t *, int delim, FILE *); +/* Read input, up to (and including) the next occurrence of DELIMITER, from + STREAM, store it in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter, + FILE *stream); # endif #elif defined GNULIB_POSIXCHECK # undef getdelim @@ -329,12 +357,13 @@ extern long rpl_ftell (FILE *fp); # define getline rpl_getline # endif # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@ - /* Read up to (and including) a newline from FP into *LINEPTR (and - NUL-terminate it). *LINEPTR is a pointer returned from malloc (or - NULL), pointing to *N characters of space. It is realloc'ed as - necessary. Returns the number of characters read (not including - the null terminator), or -1 on error or EOF. */ - extern ssize_t getline (char **, size_t *, FILE *); +/* Read a line, up to (and including) the next newline, from STREAM, store it + in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream); # endif #elif defined GNULIB_POSIXCHECK # undef getline diff --git a/lgl/stdlib_.h b/lgl/stdlib.in.h index 9ca200bcef..7d46562414 100644 --- a/lgl/stdlib_.h +++ b/lgl/stdlib.in.h @@ -2,10 +2,10 @@ Copyright (C) 1995, 2001-2002, 2006-2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,8 +13,7 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #if defined __need_malloc_and_calloc /* Special invocation convention inside glibc header files. */ diff --git a/lgl/string_.h b/lgl/string.in.h index b7edebed56..f458f4400d 100644 --- a/lgl/string_.h +++ b/lgl/string.in.h @@ -539,6 +539,21 @@ extern char * mbssep (char **stringp, const char *delim); extern char * mbstok_r (char *string, const char *delim, char **save_ptr); #endif +/* Map any int, typically from errno, into an error message. */ +#if @GNULIB_STRERROR@ +# if @REPLACE_STRERROR@ +# undef strerror +# define strerror rpl_strerror +extern char *strerror (int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror +# define strerror(e) \ + (GL_LINK_WARNING ("strerror is unportable - " \ + "use gnulib module strerror to guarantee non-NULL result"), \ + strerror (e)) +#endif + #ifdef __cplusplus } diff --git a/lgl/sys_socket_.h b/lgl/sys_socket.in.h index 35cde40b23..35cde40b23 100644 --- a/lgl/sys_socket_.h +++ b/lgl/sys_socket.in.h diff --git a/lgl/sys_stat_.h b/lgl/sys_stat.in.h index ff2159f3e0..ff2159f3e0 100644 --- a/lgl/sys_stat_.h +++ b/lgl/sys_stat.in.h diff --git a/lgl/time_.h b/lgl/time.in.h index 3f5ad0061f..3f5ad0061f 100644 --- a/lgl/time_.h +++ b/lgl/time.in.h diff --git a/lgl/unistd_.h b/lgl/unistd.in.h index 5405baf881..5405baf881 100644 --- a/lgl/unistd_.h +++ b/lgl/unistd.in.h diff --git a/lgl/vasnprintf.c b/lgl/vasnprintf.c index 75c6e9ee9f..ee7c319023 100644 --- a/lgl/vasnprintf.c +++ b/lgl/vasnprintf.c @@ -3385,9 +3385,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #endif *fbp = dp->conversion; #if USE_SNPRINTF +# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) fbp[1] = '%'; fbp[2] = 'n'; fbp[3] = '\0'; +# else + /* On glibc2 systems from glibc >= 2.3 - probably also older + ones - we know that snprintf's returns value conforms to + ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. + Therefore we can avoid using %n in this situation. + On glibc2 systems from 2004-10-18 or newer, the use of %n + in format strings in writable memory may crash the program + (if compiled with _FORTIFY_SOURCE=2), so we should avoid it + in this situation. */ + fbp[1] = '\0'; +# endif #else fbp[1] = '\0'; #endif @@ -3430,7 +3442,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* SNPRINTF can fail if its second argument is > INT_MAX. */ if (maxlen > INT_MAX / TCHARS_PER_DCHAR) - goto overflow; + maxlen = INT_MAX / TCHARS_PER_DCHAR; maxlen = maxlen * TCHARS_PER_DCHAR; # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ @@ -3651,17 +3663,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Handle overflow of the allocated buffer. */ if (count >= maxlen) { - /* Need at least count * sizeof (TCHAR_T) bytes. But - allocate proportionally, to avoid looping eternally - if snprintf() reports a too small count. */ - size_t n = - xmax (xsum (length, - (count + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR), - xtimes (allocated, 2)); - - ENSURE_ALLOCATION (n); - continue; + /* If maxlen already has attained its allowed maximum, + allocating more memory will not increase maxlen. + Instead of looping, bail out. */ + if (maxlen == INT_MAX / TCHARS_PER_DCHAR) + goto overflow; + else + { + /* Need at least count * sizeof (TCHAR_T) bytes. + But allocate proportionally, to avoid looping + eternally if snprintf() reports a too small + count. */ + size_t n = + xmax (xsum (length, + (count + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR), + xtimes (allocated, 2)); + + ENSURE_ALLOCATION (n); + continue; + } } #endif diff --git a/lgl/wchar_.h b/lgl/wchar.in.h index 0aba1cac10..0aba1cac10 100644 --- a/lgl/wchar_.h +++ b/lgl/wchar.in.h |