aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dosname.h5
-rw-r--r--lib/dup2.c2
-rw-r--r--lib/errno.in.h4
-rw-r--r--lib/euidaccess.c4
-rw-r--r--lib/fcntl.c4
-rw-r--r--lib/fcntl.in.h2
-rw-r--r--lib/fpending.c3
-rw-r--r--lib/fsync.c2
-rw-r--r--lib/getdtablesize.c2
-rw-r--r--lib/getopt.c2
-rw-r--r--lib/gettimeofday.c2
-rw-r--r--lib/gnulib.mk.in32
-rw-r--r--lib/inttypes.in.h6
-rw-r--r--lib/md5.c15
-rw-r--r--lib/md5.h7
-rw-r--r--lib/open.c2
-rw-r--r--lib/pipe2.c7
-rw-r--r--lib/putenv.c4
-rw-r--r--lib/sha1.c17
-rw-r--r--lib/sha1.h7
-rw-r--r--lib/sha256.c119
-rw-r--r--lib/sha256.h7
-rw-r--r--lib/sha512.c107
-rw-r--r--lib/sha512.h7
-rw-r--r--lib/stat-time.h2
-rw-r--r--lib/stdio-impl.h62
-rw-r--r--lib/stdio.in.h4
-rw-r--r--lib/stdlib.in.h4
-rw-r--r--lib/sys_stat.in.h6
-rw-r--r--lib/sys_types.in.h15
-rw-r--r--lib/timespec.h2
-rw-r--r--lib/unistd.in.h8
-rw-r--r--lib/utimens.c3
33 files changed, 242 insertions, 233 deletions
diff --git a/lib/dosname.h b/lib/dosname.h
index 66486d5209d..fef3b6daa1f 100644
--- a/lib/dosname.h
+++ b/lib/dosname.h
@@ -20,9 +20,8 @@
20#ifndef _DOSNAME_H 20#ifndef _DOSNAME_H
21#define _DOSNAME_H 21#define _DOSNAME_H
22 22
23#if (defined _WIN32 || defined __WIN32__ || \ 23#if (defined _WIN32 || defined __CYGWIN__ \
24 defined __MSDOS__ || defined __CYGWIN__ || \ 24 || defined __EMX__ || defined __MSDOS__ || defined __DJGPP__)
25 defined __EMX__ || defined __DJGPP__)
26 /* This internal macro assumes ASCII, but all hosts that support drive 25 /* This internal macro assumes ASCII, but all hosts that support drive
27 letters use ASCII. */ 26 letters use ASCII. */
28# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ 27# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \
diff --git a/lib/dup2.c b/lib/dup2.c
index c8b49b25e47..c7d176728d4 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -29,7 +29,7 @@
29 29
30# undef dup2 30# undef dup2
31 31
32# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 32# if defined _WIN32 && ! defined __CYGWIN__
33 33
34/* Get declarations of the native Windows API functions. */ 34/* Get declarations of the native Windows API functions. */
35# define WIN32_LEAN_AND_MEAN 35# define WIN32_LEAN_AND_MEAN
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 8d2f3074fab..b95c4e9ce76 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -30,7 +30,7 @@
30 30
31 31
32/* On native Windows platforms, many macros are not defined. */ 32/* On native Windows platforms, many macros are not defined. */
33# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 33# if defined _WIN32 && ! defined __CYGWIN__
34 34
35/* These are the same values as defined by MSVC 10, for interoperability. */ 35/* These are the same values as defined by MSVC 10, for interoperability. */
36 36
@@ -248,7 +248,7 @@
248 interoperability. */ 248 interoperability. */
249# define EOWNERDEAD 58 249# define EOWNERDEAD 58
250# define ENOTRECOVERABLE 59 250# define ENOTRECOVERABLE 59
251# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 251# elif defined _WIN32 && ! defined __CYGWIN__
252 /* We have a conflict here: pthreads-win32 defines these values 252 /* We have a conflict here: pthreads-win32 defines these values
253 differently than MSVC 10. It's hairy to decide which one to use. */ 253 differently than MSVC 10. It's hairy to decide which one to use. */
254# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS 254# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index 4f512f5af54..de5d82b52d5 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -29,7 +29,7 @@
29#include <sys/types.h> 29#include <sys/types.h>
30#include <sys/stat.h> 30#include <sys/stat.h>
31#include <unistd.h> 31#include <unistd.h>
32#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 32#if defined _WIN32 && ! defined __CYGWIN__
33# include <io.h> 33# include <io.h>
34#else 34#else
35# include "root-uid.h" 35# include "root-uid.h"
@@ -87,7 +87,7 @@ euidaccess (const char *file, int mode)
87 return accessx (file, mode, ACC_SELF); 87 return accessx (file, mode, ACC_SELF);
88#elif HAVE_EACCESS /* FreeBSD */ 88#elif HAVE_EACCESS /* FreeBSD */
89 return eaccess (file, mode); 89 return eaccess (file, mode);
90#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* mingw */ 90#elif defined _WIN32 && ! defined __CYGWIN__ /* mingw */
91 return _access (file, mode); 91 return _access (file, mode);
92#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, BeOS */ 92#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, BeOS */
93 93
diff --git a/lib/fcntl.c b/lib/fcntl.c
index b8cb271f55c..be6583565b4 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -32,7 +32,7 @@
32#endif 32#endif
33#undef fcntl 33#undef fcntl
34 34
35#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 35#if defined _WIN32 && ! defined __CYGWIN__
36/* Get declarations of the native Windows API functions. */ 36/* Get declarations of the native Windows API functions. */
37# define WIN32_LEAN_AND_MEAN 37# define WIN32_LEAN_AND_MEAN
38# include <windows.h> 38# include <windows.h>
@@ -376,7 +376,7 @@ rpl_fcntl (int fd, int action, /* arg */...)
376#if !HAVE_FCNTL 376#if !HAVE_FCNTL
377 case F_GETFD: 377 case F_GETFD:
378 { 378 {
379# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 379# if defined _WIN32 && ! defined __CYGWIN__
380 HANDLE handle = (HANDLE) _get_osfhandle (fd); 380 HANDLE handle = (HANDLE) _get_osfhandle (fd);
381 DWORD flags; 381 DWORD flags;
382 if (handle == INVALID_HANDLE_VALUE 382 if (handle == INVALID_HANDLE_VALUE
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 719a54d0f72..a1e7d35c1b9 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -68,7 +68,7 @@
68 68
69/* Native Windows platforms declare open(), creat() in <io.h>. */ 69/* Native Windows platforms declare open(), creat() in <io.h>. */
70#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ 70#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
71 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 71 && (defined _WIN32 && ! defined __CYGWIN__)
72# include <io.h> 72# include <io.h>
73#endif 73#endif
74 74
diff --git a/lib/fpending.c b/lib/fpending.c
index 7bc235deda2..de370d4b10f 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -24,6 +24,9 @@
24 24
25#include "stdio-impl.h" 25#include "stdio-impl.h"
26 26
27/* This file is not used on systems that already have the __fpending function,
28 namely glibc >= 2.2, Solaris >= 7, Android API >= 23. */
29
27/* Return the number of pending (aka buffered, unflushed) 30/* Return the number of pending (aka buffered, unflushed)
28 bytes on the stream, FP, that is open for writing. */ 31 bytes on the stream, FP, that is open for writing. */
29size_t 32size_t
diff --git a/lib/fsync.c b/lib/fsync.c
index a0b12b6ccc7..ecacb0ba25e 100644
--- a/lib/fsync.c
+++ b/lib/fsync.c
@@ -25,7 +25,7 @@
25#include <config.h> 25#include <config.h>
26#include <unistd.h> 26#include <unistd.h>
27 27
28#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 28#if defined _WIN32 && ! defined __CYGWIN__
29 29
30/* FlushFileBuffers */ 30/* FlushFileBuffers */
31# define WIN32_LEAN_AND_MEAN 31# define WIN32_LEAN_AND_MEAN
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index c6c1136fc55..ac05bc483cc 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -20,7 +20,7 @@
20/* Specification. */ 20/* Specification. */
21#include <unistd.h> 21#include <unistd.h>
22 22
23#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 23#if defined _WIN32 && ! defined __CYGWIN__
24 24
25# include <stdio.h> 25# include <stdio.h>
26 26
diff --git a/lib/getopt.c b/lib/getopt.c
index 55375ccd40f..11e36eef815 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -46,7 +46,7 @@
46/* When used standalone, flockfile and funlockfile might not be 46/* When used standalone, flockfile and funlockfile might not be
47 available. */ 47 available. */
48# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \ 48# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \
49 || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) 49 || (defined _WIN32 && ! defined __CYGWIN__))
50# define flockfile(fp) /* nop */ 50# define flockfile(fp) /* nop */
51# define funlockfile(fp) /* nop */ 51# define funlockfile(fp) /* nop */
52# endif 52# endif
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index 39575658264..d598b2f7f56 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -24,7 +24,7 @@
24 24
25#include <time.h> 25#include <time.h>
26 26
27#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 27#if defined _WIN32 && ! defined __CYGWIN__
28# define WINDOWS_NATIVE 28# define WINDOWS_NATIVE
29# include <windows.h> 29# include <windows.h>
30#endif 30#endif
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index ce47b9de661..19128bab2da 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -21,7 +21,7 @@
21# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
22# 22#
23# Generated by gnulib-tool. 23# Generated by gnulib-tool.
24# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 d-type diffseq dtoastr dtotimespec dup2 environ execinfo explicit_bzero faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsusage fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime nstrftime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strtoimax symlink sys_stat sys_time tempname time time_r time_rz timegm timer-time timespec-add timespec-sub unlocked-io update-copyright utimens vla warnings 24# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer d-type diffseq dtoastr dtotimespec dup2 environ execinfo explicit_bzero faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsusage fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime nstrftime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strtoimax symlink sys_stat sys_time tempname time time_r time_rz timegm timer-time timespec-add timespec-sub unlocked-io update-copyright utimens vla warnings
25 25
26 26
27MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
@@ -387,6 +387,7 @@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
387HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ 387HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
388HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ 388HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
389HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ 389HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
390HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@
390HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ 391HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
391HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@ 392HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
392HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ 393HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
@@ -421,6 +422,7 @@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
421HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ 422HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
422HAVE_GRANTPT = @HAVE_GRANTPT@ 423HAVE_GRANTPT = @HAVE_GRANTPT@
423HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ 424HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
425HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
424HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ 426HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
425HAVE_LCHMOD = @HAVE_LCHMOD@ 427HAVE_LCHMOD = @HAVE_LCHMOD@
426HAVE_LCHOWN = @HAVE_LCHOWN@ 428HAVE_LCHOWN = @HAVE_LCHOWN@
@@ -513,7 +515,6 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
513HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ 515HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
514HAVE_TIMEGM = @HAVE_TIMEGM@ 516HAVE_TIMEGM = @HAVE_TIMEGM@
515HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ 517HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
516HAVE_TRUNCATE = @HAVE_TRUNCATE@
517HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ 518HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
518HAVE_TZSET = @HAVE_TZSET@ 519HAVE_TZSET = @HAVE_TZSET@
519HAVE_UNISTD_H = @HAVE_UNISTD_H@ 520HAVE_UNISTD_H = @HAVE_UNISTD_H@
@@ -1151,45 +1152,45 @@ EXTRA_DIST += count-trailing-zeros.h
1151endif 1152endif
1152## end gnulib module count-trailing-zeros 1153## end gnulib module count-trailing-zeros
1153 1154
1154## begin gnulib module crypto/md5 1155## begin gnulib module crypto/md5-buffer
1155ifeq (,$(OMIT_GNULIB_MODULE_crypto/md5)) 1156ifeq (,$(OMIT_GNULIB_MODULE_crypto/md5-buffer))
1156 1157
1157libgnu_a_SOURCES += md5.c 1158libgnu_a_SOURCES += md5.c
1158 1159
1159EXTRA_DIST += gl_openssl.h md5.h 1160EXTRA_DIST += gl_openssl.h md5.h
1160 1161
1161endif 1162endif
1162## end gnulib module crypto/md5 1163## end gnulib module crypto/md5-buffer
1163 1164
1164## begin gnulib module crypto/sha1 1165## begin gnulib module crypto/sha1-buffer
1165ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha1)) 1166ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha1-buffer))
1166 1167
1167libgnu_a_SOURCES += sha1.c 1168libgnu_a_SOURCES += sha1.c
1168 1169
1169EXTRA_DIST += gl_openssl.h sha1.h 1170EXTRA_DIST += gl_openssl.h sha1.h
1170 1171
1171endif 1172endif
1172## end gnulib module crypto/sha1 1173## end gnulib module crypto/sha1-buffer
1173 1174
1174## begin gnulib module crypto/sha256 1175## begin gnulib module crypto/sha256-buffer
1175ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha256)) 1176ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha256-buffer))
1176 1177
1177libgnu_a_SOURCES += sha256.c 1178libgnu_a_SOURCES += sha256.c
1178 1179
1179EXTRA_DIST += gl_openssl.h sha256.h 1180EXTRA_DIST += gl_openssl.h sha256.h
1180 1181
1181endif 1182endif
1182## end gnulib module crypto/sha256 1183## end gnulib module crypto/sha256-buffer
1183 1184
1184## begin gnulib module crypto/sha512 1185## begin gnulib module crypto/sha512-buffer
1185ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha512)) 1186ifeq (,$(OMIT_GNULIB_MODULE_crypto/sha512-buffer))
1186 1187
1187libgnu_a_SOURCES += sha512.c 1188libgnu_a_SOURCES += sha512.c
1188 1189
1189EXTRA_DIST += gl_openssl.h sha512.h 1190EXTRA_DIST += gl_openssl.h sha512.h
1190 1191
1191endif 1192endif
1192## end gnulib module crypto/sha512 1193## end gnulib module crypto/sha512-buffer
1193 1194
1194## begin gnulib module diffseq 1195## begin gnulib module diffseq
1195ifeq (,$(OMIT_GNULIB_MODULE_diffseq)) 1196ifeq (,$(OMIT_GNULIB_MODULE_diffseq))
@@ -1717,6 +1718,7 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
1717 -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ 1718 -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
1718 -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ 1719 -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
1719 -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ 1720 -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
1721 -e 's/@''HAVE_IMAXDIV_T''@/$(HAVE_IMAXDIV_T)/g' \
1720 -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \ 1722 -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
1721 -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \ 1723 -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \
1722 -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ 1724 -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
@@ -2984,7 +2986,6 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2984 -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ 2986 -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
2985 -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ 2987 -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
2986 -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ 2988 -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
2987 -e 's|@''HAVE_TRUNCATE''@|$(HAVE_TRUNCATE)|g' \
2988 -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ 2989 -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
2989 -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ 2990 -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
2990 -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ 2991 -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
@@ -2996,6 +2997,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2996 -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ 2997 -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
2997 -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ 2998 -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
2998 -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \ 2999 -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
3000 -e 's|@''HAVE_DECL_TRUNCATE''@|$(HAVE_DECL_TRUNCATE)|g' \
2999 -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ 3001 -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
3000 -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ 3002 -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
3001 -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ 3003 -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index ca3cec5b477..c7d7968e6e9 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -52,7 +52,7 @@
52/* Get CHAR_BIT. */ 52/* Get CHAR_BIT. */
53#include <limits.h> 53#include <limits.h>
54/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */ 54/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */
55#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 55#if defined _WIN32 && ! defined __CYGWIN__
56# include <stdio.h> 56# include <stdio.h>
57#endif 57#endif
58 58
@@ -1067,11 +1067,13 @@ _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
1067#endif 1067#endif
1068 1068
1069#if @GNULIB_IMAXDIV@ 1069#if @GNULIB_IMAXDIV@
1070# if !@HAVE_DECL_IMAXDIV@ 1070# if !@HAVE_IMAXDIV_T@
1071# if !GNULIB_defined_imaxdiv_t 1071# if !GNULIB_defined_imaxdiv_t
1072typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; 1072typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
1073# define GNULIB_defined_imaxdiv_t 1 1073# define GNULIB_defined_imaxdiv_t 1
1074# endif 1074# endif
1075# endif
1076# if !@HAVE_DECL_IMAXDIV@
1075extern imaxdiv_t imaxdiv (intmax_t, intmax_t); 1077extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
1076# endif 1078# endif
1077#elif defined GNULIB_POSIXCHECK 1079#elif defined GNULIB_POSIXCHECK
diff --git a/lib/md5.c b/lib/md5.c
index 9dc915e2cf0..577aab46d7a 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -134,21 +134,29 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
134} 134}
135#endif 135#endif
136 136
137#if defined _LIBC || defined GL_COMPILE_CRYPTO_STREAM
138
139#include "af_alg.h"
140
137/* Compute MD5 message digest for bytes read from STREAM. The 141/* Compute MD5 message digest for bytes read from STREAM. The
138 resulting message digest number will be written into the 16 bytes 142 resulting message digest number will be written into the 16 bytes
139 beginning at RESBLOCK. */ 143 beginning at RESBLOCK. */
140int 144int
141md5_stream (FILE *stream, void *resblock) 145md5_stream (FILE *stream, void *resblock)
142{ 146{
143 struct md5_ctx ctx; 147 switch (afalg_stream (stream, "md5", resblock, MD5_DIGEST_SIZE))
144 size_t sum; 148 {
149 case 0: return 0;
150 case -EIO: return 1;
151 }
145 152
146 char *buffer = malloc (BLOCKSIZE + 72); 153 char *buffer = malloc (BLOCKSIZE + 72);
147 if (!buffer) 154 if (!buffer)
148 return 1; 155 return 1;
149 156
150 /* Initialize the computation context. */ 157 struct md5_ctx ctx;
151 md5_init_ctx (&ctx); 158 md5_init_ctx (&ctx);
159 size_t sum;
152 160
153 /* Iterate over full file contents. */ 161 /* Iterate over full file contents. */
154 while (1) 162 while (1)
@@ -206,6 +214,7 @@ process_partial_block:
206 free (buffer); 214 free (buffer);
207 return 0; 215 return 0;
208} 216}
217#endif
209 218
210#if ! HAVE_OPENSSL_MD5 219#if ! HAVE_OPENSSL_MD5
211/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The 220/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
diff --git a/lib/md5.h b/lib/md5.h
index d89f819a97b..db031aac04c 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -122,8 +122,11 @@ extern void *__md5_buffer (const char *buffer, size_t len,
122 void *resblock) __THROW; 122 void *resblock) __THROW;
123 123
124# endif 124# endif
125/* Compute MD5 message digest for bytes read from STREAM. The 125/* Compute MD5 message digest for bytes read from STREAM.
126 resulting message digest number will be written into the 16 bytes 126 STREAM is an open file stream. Regular files are handled more efficiently.
127 The contents of STREAM from its current position to its end will be read.
128 The case that the last operation on STREAM was an 'ungetc' is not supported.
129 The resulting message digest number will be written into the 16 bytes
127 beginning at RESBLOCK. */ 130 beginning at RESBLOCK. */
128extern int __md5_stream (FILE *stream, void *resblock) __THROW; 131extern int __md5_stream (FILE *stream, void *resblock) __THROW;
129 132
diff --git a/lib/open.c b/lib/open.c
index b344f13a92a..792e258ba0b 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -86,7 +86,7 @@ open (const char *filename, int flags, ...)
86 flags &= ~O_NONBLOCK; 86 flags &= ~O_NONBLOCK;
87#endif 87#endif
88 88
89#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 89#if defined _WIN32 && ! defined __CYGWIN__
90 if (strcmp (filename, "/dev/null") == 0) 90 if (strcmp (filename, "/dev/null") == 0)
91 filename = "NUL"; 91 filename = "NUL";
92#endif 92#endif
diff --git a/lib/pipe2.c b/lib/pipe2.c
index 807ba6a9f9d..c16d9351ec8 100644
--- a/lib/pipe2.c
+++ b/lib/pipe2.c
@@ -29,7 +29,7 @@
29# include "nonblocking.h" 29# include "nonblocking.h"
30#endif 30#endif
31 31
32#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 32#if defined _WIN32 && ! defined __CYGWIN__
33/* Native Windows API. */ 33/* Native Windows API. */
34 34
35# include <io.h> 35# include <io.h>
@@ -73,7 +73,7 @@ pipe2 (int fd[2], int flags)
73 return -1; 73 return -1;
74 } 74 }
75 75
76#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 76#if defined _WIN32 && ! defined __CYGWIN__
77/* Native Windows API. */ 77/* Native Windows API. */
78 78
79 if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0) 79 if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
@@ -152,8 +152,7 @@ pipe2 (int fd[2], int flags)
152 152
153#endif 153#endif
154 154
155#if GNULIB_defined_O_NONBLOCK || \ 155#if GNULIB_defined_O_NONBLOCK || !(defined _WIN32 && ! defined __CYGWIN__)
156 !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
157 fail: 156 fail:
158 { 157 {
159 int saved_errno = errno; 158 int saved_errno = errno;
diff --git a/lib/putenv.c b/lib/putenv.c
index 556d5f82302..801e372c329 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -34,7 +34,7 @@
34#include <string.h> 34#include <string.h>
35#include <unistd.h> 35#include <unistd.h>
36 36
37#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 37#if defined _WIN32 && ! defined __CYGWIN__
38# define WIN32_LEAN_AND_MEAN 38# define WIN32_LEAN_AND_MEAN
39# include <windows.h> 39# include <windows.h>
40#endif 40#endif
@@ -153,7 +153,7 @@ putenv (char *string)
153 *ep = string; 153 *ep = string;
154 break; 154 break;
155 } 155 }
156# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 156# if defined _WIN32 && ! defined __CYGWIN__
157 if (putenv_result == 0) 157 if (putenv_result == 0)
158 { 158 {
159 /* _putenv propagated "NAME= " into the subprocess environment; 159 /* _putenv propagated "NAME= " into the subprocess environment;
diff --git a/lib/sha1.c b/lib/sha1.c
index ce0f0b2e71f..8306d887da5 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -122,21 +122,29 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
122} 122}
123#endif 123#endif
124 124
125#ifdef GL_COMPILE_CRYPTO_STREAM
126
127#include "af_alg.h"
128
125/* Compute SHA1 message digest for bytes read from STREAM. The 129/* Compute SHA1 message digest for bytes read from STREAM. The
126 resulting message digest number will be written into the 16 bytes 130 resulting message digest number will be written into the 20 bytes
127 beginning at RESBLOCK. */ 131 beginning at RESBLOCK. */
128int 132int
129sha1_stream (FILE *stream, void *resblock) 133sha1_stream (FILE *stream, void *resblock)
130{ 134{
131 struct sha1_ctx ctx; 135 switch (afalg_stream (stream, "sha1", resblock, SHA1_DIGEST_SIZE))
132 size_t sum; 136 {
137 case 0: return 0;
138 case -EIO: return 1;
139 }
133 140
134 char *buffer = malloc (BLOCKSIZE + 72); 141 char *buffer = malloc (BLOCKSIZE + 72);
135 if (!buffer) 142 if (!buffer)
136 return 1; 143 return 1;
137 144
138 /* Initialize the computation context. */ 145 struct sha1_ctx ctx;
139 sha1_init_ctx (&ctx); 146 sha1_init_ctx (&ctx);
147 size_t sum;
140 148
141 /* Iterate over full file contents. */ 149 /* Iterate over full file contents. */
142 while (1) 150 while (1)
@@ -194,6 +202,7 @@ sha1_stream (FILE *stream, void *resblock)
194 free (buffer); 202 free (buffer);
195 return 0; 203 return 0;
196} 204}
205#endif
197 206
198#if ! HAVE_OPENSSL_SHA1 207#if ! HAVE_OPENSSL_SHA1
199/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The 208/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
diff --git a/lib/sha1.h b/lib/sha1.h
index b1db15da1e7..9419750f485 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -87,8 +87,11 @@ extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
87extern void *sha1_buffer (const char *buffer, size_t len, void *resblock); 87extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
88 88
89# endif 89# endif
90/* Compute SHA1 message digest for bytes read from STREAM. The 90/* Compute SHA1 message digest for bytes read from STREAM.
91 resulting message digest number will be written into the 20 bytes 91 STREAM is an open file stream. Regular files are handled more efficiently.
92 The contents of STREAM from its current position to its end will be read.
93 The case that the last operation on STREAM was an 'ungetc' is not supported.
94 The resulting message digest number will be written into the 20 bytes
92 beginning at RESBLOCK. */ 95 beginning at RESBLOCK. */
93extern int sha1_stream (FILE *stream, void *resblock); 96extern int sha1_stream (FILE *stream, void *resblock);
94 97
diff --git a/lib/sha256.c b/lib/sha256.c
index 85405b20fdf..a036befcafd 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -91,17 +91,17 @@ sha224_init_ctx (struct sha256_ctx *ctx)
91 ctx->buflen = 0; 91 ctx->buflen = 0;
92} 92}
93 93
94/* Copy the value from v into the memory location pointed to by *cp, 94/* Copy the value from v into the memory location pointed to by *CP,
95 If your architecture allows unaligned access this is equivalent to 95 If your architecture allows unaligned access, this is equivalent to
96 * (uint32_t *) cp = v */ 96 * (__typeof__ (v) *) cp = v */
97static void 97static void
98set_uint32 (char *cp, uint32_t v) 98set_uint32 (char *cp, uint32_t v)
99{ 99{
100 memcpy (cp, &v, sizeof v); 100 memcpy (cp, &v, sizeof v);
101} 101}
102 102
103/* Put result from CTX in first 32 bytes following RESBUF. The result 103/* Put result from CTX in first 32 bytes following RESBUF.
104 must be in little endian byte order. */ 104 The result must be in little endian byte order. */
105void * 105void *
106sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf) 106sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
107{ 107{
@@ -169,21 +169,32 @@ sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
169} 169}
170#endif 170#endif
171 171
172/* Compute SHA256 message digest for bytes read from STREAM. The 172#ifdef GL_COMPILE_CRYPTO_STREAM
173 resulting message digest number will be written into the 32 bytes 173
174 beginning at RESBLOCK. */ 174#include "af_alg.h"
175int 175
176sha256_stream (FILE *stream, void *resblock) 176/* Compute message digest for bytes read from STREAM using algorithm ALG.
177 Write the message digest into RESBLOCK, which contains HASHLEN bytes.
178 The initial and finishing operations are INIT_CTX and FINISH_CTX.
179 Return zero if and only if successful. */
180static int
181shaxxx_stream (FILE *stream, char const *alg, void *resblock,
182 ssize_t hashlen, void (*init_ctx) (struct sha256_ctx *),
183 void *(*finish_ctx) (struct sha256_ctx *, void *))
177{ 184{
178 struct sha256_ctx ctx; 185 switch (afalg_stream (stream, alg, resblock, hashlen))
179 size_t sum; 186 {
187 case 0: return 0;
188 case -EIO: return 1;
189 }
180 190
181 char *buffer = malloc (BLOCKSIZE + 72); 191 char *buffer = malloc (BLOCKSIZE + 72);
182 if (!buffer) 192 if (!buffer)
183 return 1; 193 return 1;
184 194
185 /* Initialize the computation context. */ 195 struct sha256_ctx ctx;
186 sha256_init_ctx (&ctx); 196 init_ctx (&ctx);
197 size_t sum;
187 198
188 /* Iterate over full file contents. */ 199 /* Iterate over full file contents. */
189 while (1) 200 while (1)
@@ -237,84 +248,28 @@ sha256_stream (FILE *stream, void *resblock)
237 sha256_process_bytes (buffer, sum, &ctx); 248 sha256_process_bytes (buffer, sum, &ctx);
238 249
239 /* Construct result in desired memory. */ 250 /* Construct result in desired memory. */
240 sha256_finish_ctx (&ctx, resblock); 251 finish_ctx (&ctx, resblock);
241 free (buffer); 252 free (buffer);
242 return 0; 253 return 0;
243} 254}
244 255
245/* FIXME: Avoid code duplication */
246int 256int
247sha224_stream (FILE *stream, void *resblock) 257sha256_stream (FILE *stream, void *resblock)
248{ 258{
249 struct sha256_ctx ctx; 259 return shaxxx_stream (stream, "sha256", resblock, SHA256_DIGEST_SIZE,
250 size_t sum; 260 sha256_init_ctx, sha256_finish_ctx);
251 261}
252 char *buffer = malloc (BLOCKSIZE + 72);
253 if (!buffer)
254 return 1;
255
256 /* Initialize the computation context. */
257 sha224_init_ctx (&ctx);
258
259 /* Iterate over full file contents. */
260 while (1)
261 {
262 /* We read the file in blocks of BLOCKSIZE bytes. One call of the
263 computation function processes the whole buffer so that with the
264 next round of the loop another block can be read. */
265 size_t n;
266 sum = 0;
267
268 /* Read block. Take care for partial reads. */
269 while (1)
270 {
271 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
272
273 sum += n;
274
275 if (sum == BLOCKSIZE)
276 break;
277
278 if (n == 0)
279 {
280 /* Check for the error flag IFF N == 0, so that we don't
281 exit the loop after a partial read due to e.g., EAGAIN
282 or EWOULDBLOCK. */
283 if (ferror (stream))
284 {
285 free (buffer);
286 return 1;
287 }
288 goto process_partial_block;
289 }
290
291 /* We've read at least one byte, so ignore errors. But always
292 check for EOF, since feof may be true even though N > 0.
293 Otherwise, we could end up calling fread after EOF. */
294 if (feof (stream))
295 goto process_partial_block;
296 }
297
298 /* Process buffer with BLOCKSIZE bytes. Note that
299 BLOCKSIZE % 64 == 0
300 */
301 sha256_process_block (buffer, BLOCKSIZE, &ctx);
302 }
303
304 process_partial_block:;
305
306 /* Process any remaining bytes. */
307 if (sum > 0)
308 sha256_process_bytes (buffer, sum, &ctx);
309 262
310 /* Construct result in desired memory. */ 263int
311 sha224_finish_ctx (&ctx, resblock); 264sha224_stream (FILE *stream, void *resblock)
312 free (buffer); 265{
313 return 0; 266 return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE,
267 sha224_init_ctx, sha224_finish_ctx);
314} 268}
269#endif
315 270
316#if ! HAVE_OPENSSL_SHA256 271#if ! HAVE_OPENSSL_SHA256
317/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The 272/* Compute SHA256 message digest for LEN bytes beginning at BUFFER. The
318 result is always in little endian byte order, so that a byte-wise 273 result is always in little endian byte order, so that a byte-wise
319 output yields to the wanted ASCII representation of the message 274 output yields to the wanted ASCII representation of the message
320 digest. */ 275 digest. */
diff --git a/lib/sha256.h b/lib/sha256.h
index e3449864bb6..19ed3ccd4d0 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -89,8 +89,11 @@ extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
89extern void *sha224_buffer (const char *buffer, size_t len, void *resblock); 89extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
90 90
91# endif 91# endif
92/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The 92/* Compute SHA256 (SHA224) message digest for bytes read from STREAM.
93 resulting message digest number will be written into the 32 (28) bytes 93 STREAM is an open file stream. Regular files are handled more efficiently.
94 The contents of STREAM from its current position to its end will be read.
95 The case that the last operation on STREAM was an 'ungetc' is not supported.
96 The resulting message digest number will be written into the 32 (28) bytes
94 beginning at RESBLOCK. */ 97 beginning at RESBLOCK. */
95extern int sha256_stream (FILE *stream, void *resblock); 98extern int sha256_stream (FILE *stream, void *resblock);
96extern int sha224_stream (FILE *stream, void *resblock); 99extern int sha224_stream (FILE *stream, void *resblock);
diff --git a/lib/sha512.c b/lib/sha512.c
index 8a6dd4e83ac..e175e705f52 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -177,21 +177,32 @@ sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
177} 177}
178#endif 178#endif
179 179
180/* Compute SHA512 message digest for bytes read from STREAM. The 180#ifdef GL_COMPILE_CRYPTO_STREAM
181 resulting message digest number will be written into the 64 bytes 181
182 beginning at RESBLOCK. */ 182#include "af_alg.h"
183int 183
184sha512_stream (FILE *stream, void *resblock) 184/* Compute message digest for bytes read from STREAM using algorithm ALG.
185 Write the message digest into RESBLOCK, which contains HASHLEN bytes.
186 The initial and finishing operations are INIT_CTX and FINISH_CTX.
187 Return zero if and only if successful. */
188static int
189shaxxx_stream (FILE *stream, char const *alg, void *resblock,
190 ssize_t hashlen, void (*init_ctx) (struct sha512_ctx *),
191 void *(*finish_ctx) (struct sha512_ctx *, void *))
185{ 192{
186 struct sha512_ctx ctx; 193 switch (afalg_stream (stream, alg, resblock, hashlen))
187 size_t sum; 194 {
195 case 0: return 0;
196 case -EIO: return 1;
197 }
188 198
189 char *buffer = malloc (BLOCKSIZE + 72); 199 char *buffer = malloc (BLOCKSIZE + 72);
190 if (!buffer) 200 if (!buffer)
191 return 1; 201 return 1;
192 202
193 /* Initialize the computation context. */ 203 struct sha512_ctx ctx;
194 sha512_init_ctx (&ctx); 204 init_ctx (&ctx);
205 size_t sum;
195 206
196 /* Iterate over full file contents. */ 207 /* Iterate over full file contents. */
197 while (1) 208 while (1)
@@ -245,81 +256,25 @@ sha512_stream (FILE *stream, void *resblock)
245 sha512_process_bytes (buffer, sum, &ctx); 256 sha512_process_bytes (buffer, sum, &ctx);
246 257
247 /* Construct result in desired memory. */ 258 /* Construct result in desired memory. */
248 sha512_finish_ctx (&ctx, resblock); 259 finish_ctx (&ctx, resblock);
249 free (buffer); 260 free (buffer);
250 return 0; 261 return 0;
251} 262}
252 263
253/* FIXME: Avoid code duplication */
254int 264int
255sha384_stream (FILE *stream, void *resblock) 265sha512_stream (FILE *stream, void *resblock)
256{ 266{
257 struct sha512_ctx ctx; 267 return shaxxx_stream (stream, "sha512", resblock, SHA512_DIGEST_SIZE,
258 size_t sum; 268 sha512_init_ctx, sha512_finish_ctx);
259 269}
260 char *buffer = malloc (BLOCKSIZE + 72);
261 if (!buffer)
262 return 1;
263
264 /* Initialize the computation context. */
265 sha384_init_ctx (&ctx);
266
267 /* Iterate over full file contents. */
268 while (1)
269 {
270 /* We read the file in blocks of BLOCKSIZE bytes. One call of the
271 computation function processes the whole buffer so that with the
272 next round of the loop another block can be read. */
273 size_t n;
274 sum = 0;
275
276 /* Read block. Take care for partial reads. */
277 while (1)
278 {
279 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
280
281 sum += n;
282
283 if (sum == BLOCKSIZE)
284 break;
285
286 if (n == 0)
287 {
288 /* Check for the error flag IFF N == 0, so that we don't
289 exit the loop after a partial read due to e.g., EAGAIN
290 or EWOULDBLOCK. */
291 if (ferror (stream))
292 {
293 free (buffer);
294 return 1;
295 }
296 goto process_partial_block;
297 }
298
299 /* We've read at least one byte, so ignore errors. But always
300 check for EOF, since feof may be true even though N > 0.
301 Otherwise, we could end up calling fread after EOF. */
302 if (feof (stream))
303 goto process_partial_block;
304 }
305
306 /* Process buffer with BLOCKSIZE bytes. Note that
307 BLOCKSIZE % 128 == 0
308 */
309 sha512_process_block (buffer, BLOCKSIZE, &ctx);
310 }
311
312 process_partial_block:;
313
314 /* Process any remaining bytes. */
315 if (sum > 0)
316 sha512_process_bytes (buffer, sum, &ctx);
317 270
318 /* Construct result in desired memory. */ 271int
319 sha384_finish_ctx (&ctx, resblock); 272sha384_stream (FILE *stream, void *resblock)
320 free (buffer); 273{
321 return 0; 274 return shaxxx_stream (stream, "sha384", resblock, SHA384_DIGEST_SIZE,
275 sha384_init_ctx, sha384_finish_ctx);
322} 276}
277#endif
323 278
324#if ! HAVE_OPENSSL_SHA512 279#if ! HAVE_OPENSSL_SHA512
325/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The 280/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
diff --git a/lib/sha512.h b/lib/sha512.h
index 6a0aadba02f..2c39ab195cf 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -92,8 +92,11 @@ extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
92extern void *sha384_buffer (const char *buffer, size_t len, void *resblock); 92extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
93 93
94# endif 94# endif
95/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The 95/* Compute SHA512 (SHA384) message digest for bytes read from STREAM.
96 resulting message digest number will be written into the 64 (48) bytes 96 STREAM is an open file stream. Regular files are handled more efficiently.
97 The contents of STREAM from its current position to its end will be read.
98 The case that the last operation on STREAM was an 'ungetc' is not supported.
99 The resulting message digest number will be written into the 64 (48) bytes
97 beginning at RESBLOCK. */ 100 beginning at RESBLOCK. */
98extern int sha512_stream (FILE *stream, void *resblock); 101extern int sha512_stream (FILE *stream, void *resblock);
99extern int sha384_stream (FILE *stream, void *resblock); 102extern int sha384_stream (FILE *stream, void *resblock);
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 104f5376682..8e787bd3b2d 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -168,7 +168,7 @@ get_stat_birthtime (struct stat const *st _GL_UNUSED)
168#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 168#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
169 t.tv_sec = st->st_birthtime; 169 t.tv_sec = st->st_birthtime;
170 t.tv_nsec = st->st_birthtimensec; 170 t.tv_nsec = st->st_birthtimensec;
171#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 171#elif defined _WIN32 && ! defined __CYGWIN__
172 /* Native Windows platforms (but not Cygwin) put the "file creation 172 /* Native Windows platforms (but not Cygwin) put the "file creation
173 time" in st_ctime (!). See 173 time" in st_ctime (!). See
174 <https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */ 174 <https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 05c5752a243..393ef0cf58d 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -60,25 +60,79 @@
60# define _flags pub._flags 60# define _flags pub._flags
61# define _r pub._r 61# define _r pub._r
62# define _w pub._w 62# define _w pub._w
63# elif defined __ANDROID__ /* Android */
64 /* Up to this commit from 2015-10-12
65 <https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
66 the innards of FILE were public, and fp_ub could be defined like for OpenBSD,
67 see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h>
68 and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>.
69 After this commit, the innards of FILE are hidden. */
70# define fp_ ((struct { unsigned char *_p; \
71 int _r; \
72 int _w; \
73 int _flags; \
74 int _file; \
75 struct { unsigned char *_base; size_t _size; } _bf; \
76 int _lbfsize; \
77 void *_cookie; \
78 void *_close; \
79 void *_read; \
80 void *_seek; \
81 void *_write; \
82 struct { unsigned char *_base; size_t _size; } _ext; \
83 unsigned char *_up; \
84 int _ur; \
85 unsigned char _ubuf[3]; \
86 unsigned char _nbuf[1]; \
87 struct { unsigned char *_base; size_t _size; } _lb; \
88 int _blksize; \
89 fpos_t _offset; \
90 /* More fields, not relevant here. */ \
91 } *) fp)
63# else 92# else
64# define fp_ fp 93# define fp_ fp
65# endif 94# endif
66 95
67# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Minix 3, Android */ 96# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */
68 /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> 97 /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
69 and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ 98 and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
99 and <https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/lib/libc/stdio/fileext.h> */
70 struct __sfileext 100 struct __sfileext
71 { 101 {
72 struct __sbuf _ub; /* ungetc buffer */ 102 struct __sbuf _ub; /* ungetc buffer */
73 /* More fields, not relevant here. */ 103 /* More fields, not relevant here. */
74 }; 104 };
75# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub 105# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
76# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */ 106# elif defined __ANDROID__ /* Android */
107 struct __sfileext
108 {
109 struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */
110 /* More fields, not relevant here. */
111 };
112# define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub
113# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */
77# define fp_ub fp_->_ub 114# define fp_ub fp_->_ub
78# endif 115# endif
79 116
80# define HASUB(fp) (fp_ub._base != NULL) 117# define HASUB(fp) (fp_ub._base != NULL)
81 118
119# if defined __ANDROID__ /* Android */
120 /* Needed after this commit from 2016-01-25
121 <https://android.googlesource.com/platform/bionic.git/+/e70e0e9267d069bf56a5078c99307e08a7280de7> */
122# ifndef __SEOF
123# define __SLBF 1
124# define __SNBF 2
125# define __SRD 4
126# define __SWR 8
127# define __SRW 0x10
128# define __SEOF 0x20
129# define __SERR 0x40
130# endif
131# ifndef __SOFF
132# define __SOFF 0x1000
133# endif
134# endif
135
82#endif 136#endif
83 137
84 138
@@ -118,7 +172,7 @@
118# define _flag __flag 172# define _flag __flag
119# endif 173# endif
120 174
121#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* newer Windows with MSVC */ 175#elif defined _WIN32 && ! defined __CYGWIN__ /* newer Windows with MSVC */
122 176
123/* <stdio.h> does not define the innards of FILE any more. */ 177/* <stdio.h> does not define the innards of FILE any more. */
124# define WINDOWS_OPAQUE_FILE 178# define WINDOWS_OPAQUE_FILE
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index b9a43bb80ca..ff7c9c831ac 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -122,7 +122,7 @@
122 it before we #define perror rpl_perror. */ 122 it before we #define perror rpl_perror. */
123/* But in any case avoid namespace pollution on glibc systems. */ 123/* But in any case avoid namespace pollution on glibc systems. */
124#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ 124#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
125 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ 125 && (defined _WIN32 && ! defined __CYGWIN__) \
126 && ! defined __GLIBC__ 126 && ! defined __GLIBC__
127# include <stdlib.h> 127# include <stdlib.h>
128#endif 128#endif
@@ -133,7 +133,7 @@
133 it before we #define rename rpl_rename. */ 133 it before we #define rename rpl_rename. */
134/* But in any case avoid namespace pollution on glibc systems. */ 134/* But in any case avoid namespace pollution on glibc systems. */
135#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ 135#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
136 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ 136 && (defined _WIN32 && ! defined __CYGWIN__) \
137 && ! defined __GLIBC__ 137 && ! defined __GLIBC__
138# include <io.h> 138# include <io.h>
139#endif 139#endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index c8a5d0d0c61..3bf35bf6b0f 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -54,7 +54,7 @@
54#endif 54#endif
55 55
56/* Native Windows platforms declare mktemp() in <io.h>. */ 56/* Native Windows platforms declare mktemp() in <io.h>. */
57#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 57#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
58# include <io.h> 58# include <io.h>
59#endif 59#endif
60 60
@@ -90,7 +90,7 @@ struct random_data
90# endif 90# endif
91#endif 91#endif
92 92
93#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 93#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
94/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */ 94/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
95/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */ 95/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
96/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ 96/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index d96fde1007d..6ae6ac5fbdc 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -57,13 +57,13 @@
57/* Before doing "#define mkdir rpl_mkdir" below, we need to include all 57/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
58 headers that may declare mkdir(). Native Windows platforms declare mkdir 58 headers that may declare mkdir(). Native Windows platforms declare mkdir
59 in <io.h> and/or <direct.h>, not in <unistd.h>. */ 59 in <io.h> and/or <direct.h>, not in <unistd.h>. */
60#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 60#if defined _WIN32 && ! defined __CYGWIN__
61# include <io.h> /* mingw32, mingw64 */ 61# include <io.h> /* mingw32, mingw64 */
62# include <direct.h> /* mingw64, MSVC 9 */ 62# include <direct.h> /* mingw64, MSVC 9 */
63#endif 63#endif
64 64
65/* Native Windows platforms declare umask() in <io.h>. */ 65/* Native Windows platforms declare umask() in <io.h>. */
66#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 66#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
67# include <io.h> 67# include <io.h>
68#endif 68#endif
69 69
@@ -576,7 +576,7 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
576 Additionally, it declares _mkdir (and depending on compile flags, an 576 Additionally, it declares _mkdir (and depending on compile flags, an
577 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, 577 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
578 which are included above. */ 578 which are included above. */
579# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 579# if defined _WIN32 && ! defined __CYGWIN__
580 580
581# if !GNULIB_defined_rpl_mkdir 581# if !GNULIB_defined_rpl_mkdir
582static int 582static int
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index 747371644df..7f8c1c42117 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -20,6 +20,17 @@
20#endif 20#endif
21@PRAGMA_COLUMNS@ 21@PRAGMA_COLUMNS@
22 22
23#if defined _WIN32 && !defined __CYGWIN__ \
24 && (defined __need_off_t || defined __need___off64_t \
25 || defined __need_ssize_t || defined __need_time_t)
26
27/* Special invocation convention inside mingw header files. */
28
29#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
30
31#else
32/* Normal invocation convention. */
33
23#ifndef _@GUARD_PREFIX@_SYS_TYPES_H 34#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
24 35
25/* The include_next requires a split double-inclusion guard. */ 36/* The include_next requires a split double-inclusion guard. */
@@ -86,10 +97,10 @@ typedef unsigned long long int rpl_ino_t;
86 97
87/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */ 98/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
88/* But avoid namespace pollution on glibc systems. */ 99/* But avoid namespace pollution on glibc systems. */
89#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ 100#if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__
90 && ! defined __GLIBC__
91# include <stddef.h> 101# include <stddef.h>
92#endif 102#endif
93 103
94#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ 104#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
95#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ 105#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
106#endif /* __need_XXX */
diff --git a/lib/timespec.h b/lib/timespec.h
index eef3030d9c5..94ba8d0b6a0 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -87,7 +87,7 @@ timespec_cmp (struct timespec a, struct timespec b)
87 return 1; 87 return 1;
88 88
89 /* Pacify gcc -Wstrict-overflow (bleeding-edge circa 2017-10-02). See: 89 /* Pacify gcc -Wstrict-overflow (bleeding-edge circa 2017-10-02). See:
90 http://lists.gnu.org/r/bug-gnulib/2017-10/msg00006.html */ 90 https://lists.gnu.org/r/bug-gnulib/2017-10/msg00006.html */
91 assume (-1 <= a.tv_nsec && a.tv_nsec <= 2 * TIMESPEC_RESOLUTION); 91 assume (-1 <= a.tv_nsec && a.tv_nsec <= 2 * TIMESPEC_RESOLUTION);
92 assume (-1 <= b.tv_nsec && b.tv_nsec <= 2 * TIMESPEC_RESOLUTION); 92 assume (-1 <= b.tv_nsec && b.tv_nsec <= 2 * TIMESPEC_RESOLUTION);
93 93
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index beeb8e1d6fd..b6a348f5297 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -61,7 +61,7 @@
61/* But avoid namespace pollution on glibc systems. */ 61/* But avoid namespace pollution on glibc systems. */
62#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ 62#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
63 || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \ 63 || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \
64 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) \ 64 && (defined _WIN32 && ! defined __CYGWIN__)) \
65 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ 65 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
66 && defined __CYGWIN__)) \ 66 && defined __CYGWIN__)) \
67 && ! defined __GLIBC__ 67 && ! defined __GLIBC__
@@ -94,13 +94,13 @@
94 lseek(), read(), unlink(), write() in <io.h>. */ 94 lseek(), read(), unlink(), write() in <io.h>. */
95#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ 95#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
96 || defined GNULIB_POSIXCHECK) \ 96 || defined GNULIB_POSIXCHECK) \
97 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) 97 && (defined _WIN32 && ! defined __CYGWIN__))
98# include <io.h> /* mingw32, mingw64 */ 98# include <io.h> /* mingw32, mingw64 */
99# include <direct.h> /* mingw64, MSVC 9 */ 99# include <direct.h> /* mingw64, MSVC 9 */
100#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \ 100#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
101 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \ 101 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
102 || defined GNULIB_POSIXCHECK) \ 102 || defined GNULIB_POSIXCHECK) \
103 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 103 && (defined _WIN32 && ! defined __CYGWIN__)
104# include <io.h> 104# include <io.h>
105#endif 105#endif
106 106
@@ -1489,7 +1489,7 @@ _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
1489 _GL_ARG_NONNULL ((1))); 1489 _GL_ARG_NONNULL ((1)));
1490_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 1490_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
1491# else 1491# else
1492# if !@HAVE_TRUNCATE@ 1492# if !@HAVE_DECL_TRUNCATE@
1493_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 1493_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
1494 _GL_ARG_NONNULL ((1))); 1494 _GL_ARG_NONNULL ((1)));
1495# endif 1495# endif
diff --git a/lib/utimens.c b/lib/utimens.c
index c0b0704eb29..e65f55d82fe 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -39,8 +39,7 @@
39 GNU Emacs, which arranges for this in some other way and which 39 GNU Emacs, which arranges for this in some other way and which
40 defines WIN32_LEAN_AND_MEAN itself. */ 40 defines WIN32_LEAN_AND_MEAN itself. */
41 41
42#if ((defined _WIN32 || defined __WIN32__) \ 42#if defined _WIN32 && ! defined __CYGWIN__ && ! defined EMACS_CONFIGURATION
43 && ! defined __CYGWIN__ && ! defined EMACS_CONFIGURATION)
44# define USE_SETFILETIME 43# define USE_SETFILETIME
45# define WIN32_LEAN_AND_MEAN 44# define WIN32_LEAN_AND_MEAN
46# include <windows.h> 45# include <windows.h>