summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <jas@mocca.josefsson.org>2007-05-30 15:03:04 +0200
committerSimon Josefsson <jas@mocca.josefsson.org>2007-05-30 15:03:04 +0200
commit06692b3366ee9e8e315d67eb95c1b76ecf157176 (patch)
tree1ac9aab4a38eee4f5142a06937902ed5572fd9a3
parent331a51173f748bca0850a275dd9454486948a9da (diff)
downloadgnutls-06692b3366ee9e8e315d67eb95c1b76ecf157176.tar.gz
Update.
-rw-r--r--gl/netinet_in_.h13
-rw-r--r--gl/string_.h12
-rw-r--r--gl/sys_socket_.h15
-rw-r--r--lgl/Makefile.am4
-rw-r--r--lgl/float_.h6
-rw-r--r--lgl/fseeko.c2
-rw-r--r--lgl/lseek.c8
-rw-r--r--lgl/m4/iconv.m43
-rw-r--r--lgl/m4/lseek.m430
-rw-r--r--lgl/m4/stdio_h.m46
-rw-r--r--lgl/stdint_.h12
-rw-r--r--lgl/stdio_.h44
-rw-r--r--lgl/string_.h12
-rw-r--r--lgl/sys_socket_.h15
-rw-r--r--lgl/sys_stat_.h10
-rw-r--r--lgl/time_.h92
-rw-r--r--lgl/unistd_.h11
-rw-r--r--lgl/wchar_.h15
18 files changed, 207 insertions, 103 deletions
diff --git a/gl/netinet_in_.h b/gl/netinet_in_.h
index d46ec78e9b..2585d33e3a 100644
--- a/gl/netinet_in_.h
+++ b/gl/netinet_in_.h
@@ -16,20 +16,26 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_NETINET_IN_H
-#define _GL_NETINET_IN_H
#if @HAVE_NETINET_IN_H@
/* On many platforms, <netinet/in.h> assumes prior inclusion of
<sys/types.h>. */
-
# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard. */
# if @HAVE_INCLUDE_NEXT@
# include_next <netinet/in.h>
# else
# include @ABSOLUTE_NETINET_IN_H@
# endif
-#else
+
+#endif
+
+#ifndef _GL_NETINET_IN_H
+#define _GL_NETINET_IN_H
+
+#if !@HAVE_NETINET_IN_H@
/* A platform that lacks <netinet/in.h>. */
@@ -38,3 +44,4 @@
#endif
#endif /* _GL_NETINET_IN_H */
+#endif /* _GL_NETINET_IN_H */
diff --git a/gl/string_.h b/gl/string_.h
index 43801e823e..6ec72c3e7f 100644
--- a/gl/string_.h
+++ b/gl/string_.h
@@ -16,17 +16,18 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#ifndef _GL_STRING_H
+
+/* The include_next requires a split double-inclusion guard. */
#if @HAVE_INCLUDE_NEXT@
# include_next <string.h>
+#else
+# include @ABSOLUTE_STRING_H@
#endif
#ifndef _GL_STRING_H
#define _GL_STRING_H
-#if ! @HAVE_INCLUDE_NEXT@
-# include @ABSOLUTE_STRING_H@
-#endif
-
/* The definition of GL_LINK_WARNING is copied here. */
@@ -541,4 +542,5 @@ extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
}
#endif
-#endif
+#endif /* _GL_STRING_H */
+#endif /* _GL_STRING_H */
diff --git a/gl/sys_socket_.h b/gl/sys_socket_.h
index 7ad5bca09a..c7eb649025 100644
--- a/gl/sys_socket_.h
+++ b/gl/sys_socket_.h
@@ -16,28 +16,32 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_SYS_SOCKET_H
-#define _GL_SYS_SOCKET_H
-
/* This file is supposed to be used on platforms that lack <sys/socket.h>
and on platforms where <sys/socket.h> cannot be included standalone.
It is intended to provide definitions and prototypes needed by an
application. */
+#ifndef _GL_SYS_SOCKET_H
+
#if @HAVE_SYS_SOCKET_H@
/* On many platforms, <sys/socket.h> assumes prior inclusion of
<sys/types.h>. */
-
# include <sys/types.h>
+/* The include_next requires a split double-inclusion guard. */
# if @HAVE_INCLUDE_NEXT@
# include_next <sys/socket.h>
# else
# include @ABSOLUTE_SYS_SOCKET_H@
# endif
-#else
+#endif
+
+#ifndef _GL_SYS_SOCKET_H
+#define _GL_SYS_SOCKET_H
+
+#if !@HAVE_SYS_SOCKET_H@
/* A platform that lacks <sys/socket.h>.
@@ -88,3 +92,4 @@
#endif /* HAVE_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */
+#endif /* _GL_SYS_SOCKET_H */
diff --git a/lgl/Makefile.am b/lgl/Makefile.am
index 8bb2ee4e75..e4af9e1863 100644
--- a/lgl/Makefile.am
+++ b/lgl/Makefile.am
@@ -390,7 +390,9 @@ 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_FSEEK''@|$(GNULIB_FSEEK)|g' \
-e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
+ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
-e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
-e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
-e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
@@ -406,7 +408,9 @@ stdio.h: stdio_.h
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
+ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
-e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
+ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
-e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdio_.h; \
diff --git a/lgl/float_.h b/lgl/float_.h
index 28f39b8b57..7f796e2d62 100644
--- a/lgl/float_.h
+++ b/lgl/float_.h
@@ -17,14 +17,17 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_FLOAT_H
-#define _GL_FLOAT_H
+/* The include_next requires a split double-inclusion guard. */
#if @HAVE_INCLUDE_NEXT@
# include_next <float.h>
#else
# include @ABSOLUTE_FLOAT_H@
#endif
+#ifndef _GL_FLOAT_H
+#define _GL_FLOAT_H
+
/* 'long double' properties. */
#if defined __i386__ && defined __BEOS__
/* Number of mantissa units, in base FLT_RADIX. */
@@ -57,3 +60,4 @@
#endif
#endif /* _GL_FLOAT_H */
+#endif /* _GL_FLOAT_H */
diff --git a/lgl/fseeko.c b/lgl/fseeko.c
index b85e18bd7c..ee94376b8b 100644
--- a/lgl/fseeko.c
+++ b/lgl/fseeko.c
@@ -1,4 +1,4 @@
-/* An fseek() function that, together with fflush(), is POSIX compliant.
+/* An fseeko() function that, together with fflush(), is POSIX compliant.
Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lgl/lseek.c b/lgl/lseek.c
index be9cd81c6d..1fffab01f7 100644
--- a/lgl/lseek.c
+++ b/lgl/lseek.c
@@ -31,7 +31,13 @@ off_t
rpl_lseek (int fd, off_t offset, int whence)
{
/* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */
- if (GetFileType ((HANDLE) _get_osfhandle (fd)) != FILE_TYPE_DISK)
+ HANDLE h = (HANDLE) _get_osfhandle (fd);
+ if (h == INVALID_HANDLE_VALUE)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ if (GetFileType (h) != FILE_TYPE_DISK)
{
errno = ESPIPE;
return -1;
diff --git a/lgl/m4/iconv.m4 b/lgl/m4/iconv.m4
index 32239e31df..8e36b52d4d 100644
--- a/lgl/m4/iconv.m4
+++ b/lgl/m4/iconv.m4
@@ -1,4 +1,4 @@
-# iconv.m4 serial AM5 (gettext-0.16.2)
+# iconv.m4 serial AM6 (gettext-0.16.2)
dnl Copyright (C) 2000-2002, 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,
@@ -117,6 +117,7 @@ int main ()
&& iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
/* Try HP-UX names. */
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+ return 1;
return 0;
}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
[case "$host_os" in
diff --git a/lgl/m4/lseek.m4 b/lgl/m4/lseek.m4
index 075c2f42c2..4877bfd2e9 100644
--- a/lgl/m4/lseek.m4
+++ b/lgl/m4/lseek.m4
@@ -1,4 +1,4 @@
-# lseek.m4 serial 1
+# lseek.m4 serial 2
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,
@@ -9,12 +9,32 @@ AC_DEFUN([gl_FUNC_LSEEK],
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>],
-[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ [if test $cross_compiling = no; then
+ AC_LINK_IFELSE([
+#include <sys/types.h> /* for off_t */
+#include <stdio.h> /* for SEEK_CUR */
+#include <unistd.h>
+int main ()
+{
+ /* Exit with success only if stdin is seekable. */
+ return lseek (0, (off_t)0, SEEK_CUR) < 0;
+}],
+ [if test -s conftest$ac_exeext \
+ && ./conftest$ac_exeext < conftest.$ac_ext \
+ && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
+ gl_cv_func_lseek_pipe=yes
+ else
+ gl_cv_func_lseek_pipe=no
+ fi],
+ [gl_cv_func_lseek_pipe=no])
+ else
+ AC_LINK_IFELSE([
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* mingw mistakenly returns 0 when trying to seek on pipes. */
Choke me.
-#endif])],
- [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])])
+#endif],
+ [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
+ fi])
if test $gl_cv_func_lseek_pipe = no; then
gl_REPLACE_LSEEK
fi
diff --git a/lgl/m4/stdio_h.m4 b/lgl/m4/stdio_h.m4
index 2cddcc3313..955c91216e 100644
--- a/lgl/m4/stdio_h.m4
+++ b/lgl/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 5
+# stdio_h.m4 serial 6
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,
@@ -30,7 +30,9 @@ 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_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
+ GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
dnl Assume proper GNU behavior unless another module says otherwise.
@@ -48,8 +50,10 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
+ REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
+ REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
])
diff --git a/lgl/stdint_.h b/lgl/stdint_.h
index 22eaddf933..57f1bddb6b 100644
--- a/lgl/stdint_.h
+++ b/lgl/stdint_.h
@@ -16,14 +16,13 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_STDINT_H
-#define _GL_STDINT_H
-
/*
* ISO C 99 <stdint.h> for platforms that lack it.
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
*/
+#ifndef _GL_STDINT_H
+
/* Get those types that are already defined in other system include
files, so that we can "#define int8_t signed char" below without
worrying about a later system include file containing a "typedef
@@ -42,7 +41,8 @@
/* Other systems may have an incomplete or buggy <stdint.h>.
Include it before <inttypes.h>, since any "#include <stdint.h>"
in <inttypes.h> would reinclude us, skipping our contents because
- _GL_STDINT_H is defined. */
+ _GL_STDINT_H is defined.
+ The include_next requires a split double-inclusion guard. */
# if @HAVE_INCLUDE_NEXT@
# include_next <stdint.h>
# else
@@ -50,6 +50,9 @@
# endif
#endif
+#ifndef _GL_STDINT_H
+#define _GL_STDINT_H
+
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
@@ -506,3 +509,4 @@
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
#endif /* _GL_STDINT_H */
+#endif /* _GL_STDINT_H */
diff --git a/lgl/stdio_.h b/lgl/stdio_.h
index 2c33e489a4..a3c6081e36 100644
--- a/lgl/stdio_.h
+++ b/lgl/stdio_.h
@@ -28,17 +28,18 @@
#else
/* Normal invocation convention. */
+#ifndef _GL_STDIO_H
+
+/* The include_next requires a split double-inclusion guard. */
#if @HAVE_INCLUDE_NEXT@
# include_next <stdio.h>
+#else
+# include @ABSOLUTE_STDIO_H@
#endif
#ifndef _GL_STDIO_H
#define _GL_STDIO_H
-#if ! @HAVE_INCLUDE_NEXT@
-# include @ABSOLUTE_STDIO_H@
-#endif
-
#include <stdarg.h>
#include <stddef.h>
@@ -232,7 +233,19 @@ extern int fseeko (FILE *fp, off_t offset, int whence);
fseeko (f, o, w))
#endif
-#if defined GNULIB_POSIXCHECK
+#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
+extern int rpl_fseek (FILE *fp, long offset, int whence);
+# undef fseek
+# if defined GNULIB_POSIXCHECK
+# define fseek(f,o,w) \
+ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use fseeko function for handling of large files"), \
+ rpl_fseek (f, o, w))
+# else
+# define fseek rpl_fseek
+# endif
+#elif defined GNULIB_POSIXCHECK
# ifndef fseek
# define fseek(f,o,w) \
(GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
@@ -256,7 +269,19 @@ extern off_t ftello (FILE *fp);
ftello (f))
#endif
-#if defined GNULIB_POSIXCHECK
+#if @GNULIB_FTELL@ && @REPLACE_FTELL@
+extern long rpl_ftell (FILE *fp);
+# undef ftell
+# if GNULIB_POSIXCHECK
+# define ftell(f) \
+ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use ftello function for handling of large files"), \
+ rpl_ftell (f))
+# else
+# define ftell rpl_ftell
+# endif
+#elif defined GNULIB_POSIXCHECK
# ifndef ftell
# define ftell(f) \
(GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
@@ -270,7 +295,11 @@ extern off_t ftello (FILE *fp);
# if @REPLACE_FFLUSH@
# define fflush rpl_fflush
/* Flush all pending data on STREAM according to POSIX rules. Both
- output and seekable input streams are supported. */
+ output and seekable input streams are supported.
+ Note! LOSS OF DATA can occur if fflush is applied on an input stream
+ that is _not_seekable_ or on an update stream that is _not_seekable_
+ and in which the most recent operation was input. Seekability can
+ be tested with lseek(fileno(fp),0,SEEK_CUR). */
extern int fflush (FILE *gl_stream);
# endif
#elif defined GNULIB_POSIXCHECK
@@ -287,4 +316,5 @@ extern off_t ftello (FILE *fp);
#endif
#endif /* _GL_STDIO_H */
+#endif /* _GL_STDIO_H */
#endif
diff --git a/lgl/string_.h b/lgl/string_.h
index 44ba1193bf..75f2925334 100644
--- a/lgl/string_.h
+++ b/lgl/string_.h
@@ -16,17 +16,18 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#ifndef _GL_STRING_H
+
+/* The include_next requires a split double-inclusion guard. */
#if @HAVE_INCLUDE_NEXT@
# include_next <string.h>
+#else
+# include @ABSOLUTE_STRING_H@
#endif
#ifndef _GL_STRING_H
#define _GL_STRING_H
-#if ! @HAVE_INCLUDE_NEXT@
-# include @ABSOLUTE_STRING_H@
-#endif
-
/* The definition of GL_LINK_WARNING is copied here. */
@@ -541,4 +542,5 @@ extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
}
#endif
-#endif
+#endif /* _GL_STRING_H */
+#endif /* _GL_STRING_H */
diff --git a/lgl/sys_socket_.h b/lgl/sys_socket_.h
index e6eb21ff52..014ff5b6d0 100644
--- a/lgl/sys_socket_.h
+++ b/lgl/sys_socket_.h
@@ -16,28 +16,32 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef _GL_SYS_SOCKET_H
-#define _GL_SYS_SOCKET_H
-
/* This file is supposed to be used on platforms that lack <sys/socket.h>
and on platforms where <sys/socket.h> cannot be included standalone.
It is intended to provide definitions and prototypes needed by an
application. */
+#ifndef _GL_SYS_SOCKET_H
+
#if @HAVE_SYS_SOCKET_H@
/* On many platforms, <sys/socket.h> assumes prior inclusion of
<sys/types.h>. */
-
# include <sys/types.h>
+/* The include_next requires a split double-inclusion guard. */
# if @HAVE_INCLUDE_NEXT@
# include_next <sys/socket.h>
# else
# include @ABSOLUTE_SYS_SOCKET_H@
# endif
-#else
+#endif
+
+#ifndef _GL_SYS_SOCKET_H
+#define _GL_SYS_SOCKET_H
+
+#if !@HAVE_SYS_SOCKET_H@
/* A platform that lacks <sys/socket.h>.
@@ -88,3 +92,4 @@
#endif /* HAVE_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */
+#endif /* _GL_SYS_SOCKET_H */
diff --git a/lgl/sys_stat_.h b/lgl/sys_stat_.h
index 5331b60ad8..e1e9e67a4c 100644
--- a/lgl/sys_stat_.h
+++ b/lgl/sys_stat_.h
@@ -17,19 +17,22 @@
/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
-#ifndef _GL_SYS_STAT_H
-#define _GL_SYS_STAT_H
-
/* This file is supposed to be used on platforms where <sys/stat.h> is
incomplete. It is intended to provide definitions and prototypes
needed by an application. Start with what the system provides. */
+#ifndef _GL_SYS_STAT_H
+
+/* The include_next requires a split double-inclusion guard. */
#if @HAVE_INCLUDE_NEXT@
# include_next <sys/stat.h>
#else
# include @ABSOLUTE_SYS_STAT_H@
#endif
+#ifndef _GL_SYS_STAT_H
+#define _GL_SYS_STAT_H
+
#ifndef S_IFMT
# define S_IFMT 0170000
#endif
@@ -278,3 +281,4 @@ rpl_mkdir (char const *name, mode_t mode)
#endif
#endif /* _GL_SYS_STAT_H */
+#endif /* _GL_SYS_STAT_H */
diff --git a/lgl/time_.h b/lgl/time_.h
index b11d374ab0..5f3ae37575 100644
--- a/lgl/time_.h
+++ b/lgl/time_.h
@@ -30,94 +30,96 @@
#else
/* Normal invocation convention. */
-# if @HAVE_INCLUDE_NEXT@
-# include_next <time.h>
-# endif
-
# if ! defined _GL_TIME_H
-# define _GL_TIME_H
-# if ! @HAVE_INCLUDE_NEXT@
+/* The include_next requires a split double-inclusion guard. */
+# if @HAVE_INCLUDE_NEXT@
+# include_next <time.h>
+# else
# include @ABSOLUTE_TIME_H@
# endif
-# ifdef __cplusplus
+# if ! defined _GL_TIME_H
+# define _GL_TIME_H
+
+# ifdef __cplusplus
extern "C" {
-# endif
+# endif
/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
Or they define it with the wrong member names or define it in <sys/time.h>
(e.g., FreeBSD circa 1997). */
-# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
-# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
-# include <sys/time.h>
-# else
-# undef timespec
-# define timespec rpl_timespec
+# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
+# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
+# include <sys/time.h>
+# else
+# undef timespec
+# define timespec rpl_timespec
struct timespec
{
time_t tv_sec;
long int tv_nsec;
};
+# endif
# endif
-# endif
/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
return -1 and store the remaining time into RMTP. See
<http://www.opengroup.org/susv3xsh/nanosleep.html>. */
-# if @REPLACE_NANOSLEEP@
-# define nanosleep rpl_nanosleep
+# if @REPLACE_NANOSLEEP@
+# define nanosleep rpl_nanosleep
int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
-# endif
+# endif
/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
<http://www.opengroup.org/susv3xsh/localtime_r.html> and
<http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
-# if @REPLACE_LOCALTIME_R@
-# undef localtime_r
-# define localtime_r rpl_localtime_r
-# undef gmtime_r
-# define gmtime_r rpl_gmtime_r
+# if @REPLACE_LOCALTIME_R@
+# undef localtime_r
+# define localtime_r rpl_localtime_r
+# undef gmtime_r
+# define gmtime_r rpl_gmtime_r
struct tm *localtime_r (time_t const *restrict __timer,
struct tm *restrict __result);
struct tm *gmtime_r (time_t const *restrict __timer,
struct tm *restrict __result);
-# endif
+# endif
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
the resulting broken-down time into TM. See
<http://www.opengroup.org/susv3xsh/strptime.html>. */
-# if @REPLACE_STRPTIME@
-# undef strptime
-# define strptime rpl_strptime
+# if @REPLACE_STRPTIME@
+# undef strptime
+# define strptime rpl_strptime
char *strptime (char const *restrict __buf, char const *restrict __format,
struct tm *restrict __tm);
-# endif
+# endif
/* Convert TM to a time_t value, assuming UTC. */
-# if @REPLACE_TIMEGM@
-# undef timegm
-# define timegm rpl_timegm
+# if @REPLACE_TIMEGM@
+# undef timegm
+# define timegm rpl_timegm
time_t timegm (struct tm *__tm);
-# endif
+# endif
/* Encourage applications to avoid unsafe functions that can overrun
buffers when given outlandish struct tm values. Portable
applications should use strftime (or even sprintf) instead. */
-# if GNULIB_PORTCHECK
-# undef asctime
-# define asctime eschew_asctime
-# undef asctime_r
-# define asctime_r eschew_asctime_r
-# undef ctime
-# define ctime eschew_ctime
-# undef ctime_r
-# define ctime_r eschew_ctime_r
-# endif
+# if GNULIB_PORTCHECK
+# undef asctime
+# define asctime eschew_asctime
+# undef asctime_r
+# define asctime_r eschew_asctime_r
+# undef ctime
+# define ctime eschew_ctime
+# undef ctime_r
+# define ctime_r eschew_ctime_r
+# endif
-# ifdef __cplusplus
+# ifdef __cplusplus
}
-# endif
+# endif
-# endif
+# endif /* _GL_TIME_H */
+# endif /* _GL_TIME_H */
#endif
diff --git a/lgl/unistd_.h b/lgl/unistd_.h
index 4112507445..ce55683c11 100644
--- a/lgl/unistd_.h
+++ b/lgl/unistd_.h
@@ -16,8 +16,8 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_UNISTD_H
-#define _GL_UNISTD_H
+/* The include_next requires a split double-inclusion guard. */
#if @HAVE_UNISTD_H@
# if @HAVE_INCLUDE_NEXT@
# include_next <unistd.h>
@@ -26,6 +26,9 @@
# endif
#endif
+#ifndef _GL_UNISTD_H
+#define _GL_UNISTD_H
+
/* mingw doesn't define the SEEK_* macros in <unistd.h>. */
#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
# include <stdio.h>
@@ -188,9 +191,8 @@ extern int getlogin_r (char *name, size_t size);
#elif defined GNULIB_POSIXCHECK
# undef lseek
# define lseek(f,o,w) \
- (GL_LINK_WARNING ("lseek does not fail with ESPIPE on non-seekable " \
- "files on some systems - " \
- "use gnulib module lseek for portability"), \
+ (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
+ "systems - use gnulib module lseek for portability"), \
lseek (f, o, w))
#endif
@@ -237,3 +239,4 @@ extern unsigned int sleep (unsigned int n);
#endif /* _GL_UNISTD_H */
+#endif /* _GL_UNISTD_H */
diff --git a/lgl/wchar_.h b/lgl/wchar_.h
index 50ace41ec3..45652fc0d4 100644
--- a/lgl/wchar_.h
+++ b/lgl/wchar_.h
@@ -25,13 +25,7 @@
* For now, this just ensures proper prerequisite inclusion order.
*/
-#if @HAVE_INCLUDE_NEXT@
-# include <stdio.h>
-# include_next <wchar.h>
-#endif
-
#ifndef _GL_WCHAR_H
-#define _GL_WCHAR_H
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
@@ -42,8 +36,15 @@
#include <time.h>
/* Include the original <wchar.h>. */
-#if ! @HAVE_INCLUDE_NEXT@
+/* The include_next requires a split double-inclusion guard. */
+#if @HAVE_INCLUDE_NEXT@
+# include_next <wchar.h>
+#else
# include @ABSOLUTE_WCHAR_H@
#endif
+#ifndef _GL_WCHAR_H
+#define _GL_WCHAR_H
+
+#endif /* _GL_WCHAR_H */
#endif /* _GL_WCHAR_H */