diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:21 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:21 +0900 |
commit | 8abe09f3b00fd31d1af24d3038f881034506d651 (patch) | |
tree | 057549dc80e468dce35223ddb305aa362968ed53 /lib | |
parent | afd456999b076e5e6505dd5ca6942a5e7471c70c (diff) | |
download | wget-8abe09f3b00fd31d1af24d3038f881034506d651.tar.gz wget-8abe09f3b00fd31d1af24d3038f881034506d651.tar.bz2 wget-8abe09f3b00fd31d1af24d3038f881034506d651.zip |
Imported Upstream version 1.19.3upstream/1.19.3
Diffstat (limited to 'lib')
345 files changed, 6125 insertions, 3246 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index b11e393..e26a291 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this file. If not, see <http://www.gnu.org/licenses/>. +# along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl accept alloca announce-gen base32 bind c-ctype c-strcase c-strcasestr clock-time close connect crypto/md2 crypto/md4 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dirname fcntl flock fnmatch fopen ftello futimens getaddrinfo getline getopt-gnu getpass-gnu getpeername getsockname gettext git-version-gen gitlog-to-changelog gnupload group-member hostent iconv iconv-h inet_ntop intprops inttypes ioctl langinfo libunistring-optional limits-h link listen maintainer-makefile mbiter mbtowc memrchr mkdir mkostemp mkstemp nanosleep open pipe-posix posix_spawn quote quotearg recv regex select send setsockopt signal-h sigpipe sigprocmask snprintf socket spawn-pipe stat stdbool stdint strcase strerror_r-posix strpbrk strptime strtok_r strtoll symlink sys_types timegm tmpdir unicase/u8-tolower unistr/u8-strlen unlink unlocked-io update-copyright utimens vasprintf vsnprintf wcwidth write xmemdup0 xstrndup +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libgnu --source-base=lib/ --m4-base=m4/ --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl accept alloca announce-gen base32 bind c-ctype c-strcase c-strcasestr clock-time close connect dirname fcntl flock fnmatch fopen futimens ftello getaddrinfo getline getopt-gnu getpass-gnu getpeername getsockname gettext gitlog-to-changelog git-version-gen gnupload group-member hostent ioctl iconv iconv-h inet_ntop intprops inttypes langinfo limits-h link listen maintainer-makefile mbiter mbtowc memrchr mkdir mkstemp mkostemp nanosleep crypto/md2 crypto/md4 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 open pipe-posix posix_spawn quote quotearg recv regex select send setsockopt signal-h sigprocmask sigpipe snprintf socket spawn-pipe stat stdbool stdint strcase strerror_r-posix strpbrk strptime strtok_r strtoll symlink sys_types timegm tmpdir unlink unlocked-io update-copyright libunistring-optional unistr/u8-strlen unicase/u8-tolower utimens vasprintf vsnprintf wcwidth write xmemdup0 xstrndup AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects @@ -37,6 +37,7 @@ MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = +SUBDIRS += AM_CPPFLAGS = AM_CFLAGS = @@ -475,6 +476,13 @@ libgnu_a_SOURCES += fd-safer-flag.c dup-safer-flag.c ## end gnulib module fd-safer-flag +## begin gnulib module filename + + +EXTRA_DIST += filename.h + +## end gnulib module filename + ## begin gnulib module flexmember @@ -578,9 +586,9 @@ EXTRA_libgnu_a_SOURCES += fseeko.c ## begin gnulib module fstat -EXTRA_DIST += fstat.c +EXTRA_DIST += fstat.c stat-w32.c stat-w32.h -EXTRA_libgnu_a_SOURCES += fstat.c +EXTRA_libgnu_a_SOURCES += fstat.c stat-w32.c ## end gnulib module fstat @@ -658,11 +666,11 @@ EXTRA_libgnu_a_SOURCES += getline.c ## begin gnulib module getopt-posix -BUILT_SOURCES += $(GETOPT_H) +BUILT_SOURCES += $(GETOPT_H) $(GETOPT_CDEFS_H) # We need the following in order to create <getopt.h> when the system # doesn't have one that works with the given compiler. -getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) +getopt.h: getopt.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @@ -675,9 +683,18 @@ getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) < $(srcdir)/getopt.in.h; \ } > $@-t && \ mv -f $@-t $@ -MOSTLYCLEANFILES += getopt.h getopt.h-t -EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h +getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ + < $(srcdir)/getopt-cdefs.in.h; \ + } > $@-t && \ + mv -f $@-t $@ + +MOSTLYCLEANFILES += getopt.h getopt.h-t getopt-cdefs.h getopt-cdefs.h-t + +EXTRA_DIST += getopt-cdefs.in.h getopt-core.h getopt-ext.h getopt-pfx-core.h getopt-pfx-ext.h getopt.c getopt.in.h getopt1.c getopt_int.h EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c @@ -770,6 +787,7 @@ EXTRA_DIST += $(top_srcdir)/build-aux/gitlog-to-changelog ## begin gnulib module gnumakefile +EXTRA_DIST += $(top_srcdir)/GNUmakefile distclean-local: clean-GNUmakefile clean-GNUmakefile: test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile @@ -1137,6 +1155,15 @@ EXTRA_libgnu_a_SOURCES += localeconv.c ## end gnulib module localeconv +## begin gnulib module localtime-buffer + + +EXTRA_DIST += localtime-buffer.c localtime-buffer.h + +EXTRA_libgnu_a_SOURCES += localtime-buffer.c + +## end gnulib module localtime-buffer + ## begin gnulib module lock libgnu_a_SOURCES += glthread/lock.h glthread/lock.c @@ -1165,6 +1192,8 @@ EXTRA_libgnu_a_SOURCES += lstat.c EXTRA_DIST += $(top_srcdir)/maint.mk +EXTRA_DIST += $(top_srcdir)/maint.mk + ## end gnulib module maintainer-makefile ## begin gnulib module malloc-posix @@ -1176,6 +1205,14 @@ EXTRA_libgnu_a_SOURCES += malloc.c ## end gnulib module malloc-posix +## begin gnulib module malloca + +libgnu_a_SOURCES += malloca.c + +EXTRA_DIST += malloca.h malloca.valgrind + +## end gnulib module malloca + ## begin gnulib module mbchar libgnu_a_SOURCES += mbchar.c @@ -1738,106 +1775,60 @@ libgnu_a_SOURCES += size_max.h ## begin gnulib module snippet/_Noreturn # Because this Makefile snippet defines a variable used by other -# gnulib Makefile snippets, it must be present in all Makefile.am that +# gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. -_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h +_NORETURN_H=$(srcdir)/_Noreturn.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h +EXTRA_DIST += _Noreturn.h ## end gnulib module snippet/_Noreturn ## begin gnulib module snippet/arg-nonnull -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut -# off. -arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -ARG_NONNULL_H=arg-nonnull.h +ARG_NONNULL_H=$(srcdir)/arg-nonnull.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h +EXTRA_DIST += arg-nonnull.h ## end gnulib module snippet/arg-nonnull ## begin gnulib module snippet/c++defs -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/snippet/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -CXXDEFS_H=c++defs.h +CXXDEFS_H=$(srcdir)/c++defs.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h +EXTRA_DIST += c++defs.h ## end gnulib module snippet/c++defs ## begin gnulib module snippet/unused-parameter -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += unused-parameter.h -# The unused-parameter.h that gets inserted into generated .h files is the same -# as build-aux/snippet/unused-parameter.h, except that it has the copyright -# header cut off. -unused-parameter.h: $(top_srcdir)/build-aux/snippet/unused-parameter.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ - < $(top_srcdir)/build-aux/snippet/unused-parameter.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -UNUSED_PARAMETER_H=unused-parameter.h +UNUSED_PARAMETER_H=$(srcdir)/unused-parameter.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/unused-parameter.h +EXTRA_DIST += unused-parameter.h ## end gnulib module snippet/unused-parameter ## begin gnulib module snippet/warn-on-use -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut -# off. -warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/snippet/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -WARN_ON_USE_H=warn-on-use.h +WARN_ON_USE_H=$(srcdir)/warn-on-use.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h +EXTRA_DIST += warn-on-use.h ## end gnulib module snippet/warn-on-use @@ -1931,9 +1922,9 @@ libgnu_a_SOURCES += spawn-pipe.h spawn-pipe.c w32spawn.h ## begin gnulib module stat -EXTRA_DIST += stat.c +EXTRA_DIST += stat-w32.c stat-w32.h stat.c -EXTRA_libgnu_a_SOURCES += stat.c +EXTRA_libgnu_a_SOURCES += stat-w32.c stat.c ## end gnulib module stat @@ -2239,6 +2230,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ @@ -2257,6 +2249,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ @@ -2269,10 +2262,12 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ @@ -2383,6 +2378,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ @@ -2421,7 +2417,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ + -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ @@ -2442,20 +2439,20 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ - -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ - -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ - -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ - -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ - -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ - -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @@ -2732,6 +2729,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ + -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ @@ -2745,6 +2743,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ + -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ @@ -2828,6 +2827,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ < $(srcdir)/sys_types.in.h; \ } > $@-t && \ mv $@-t $@ @@ -2921,24 +2921,31 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ + -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \ + -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \ -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRFTIME''@/$(GNULIB_STRFTIME)/g' \ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ + -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \ + -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ + -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ + -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|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' \ @@ -3047,7 +3054,7 @@ EXTRA_DIST += unicase/caseprop.h unicase/ignorable.h unictype/bitmap.h libgnu_a_SOURCES += unicase/special-casing.c -unicase/special-casing-table.h: $(srcdir)/unicase/special-casing-table.gperf +$(srcdir)/unicase/special-casing-table.h: $(srcdir)/unicase/special-casing-table.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/unicase/special-casing-table.gperf > $(srcdir)/unicase/special-casing-table.h-t && \ mv $(srcdir)/unicase/special-casing-table.h-t $(srcdir)/unicase/special-casing-table.h BUILT_SOURCES += unicase/special-casing-table.h @@ -3055,7 +3062,19 @@ MOSTLYCLEANFILES += unicase/special-casing-table.h-t MAINTAINERCLEANFILES += unicase/special-casing-table.h EXTRA_DIST += unicase/special-casing-table.h -EXTRA_DIST += unicase/special-casing-table.gperf unicase/special-casing.h +# Generate special-casing.h with a declaration that depends on the gperf version. +unicase/special-casing.h: unicase/special-casing.in.h unicase/special-casing-table.h + $(AM_V_at)$(MKDIR_P) unicase + $(AM_V_GEN)rm -f $@-t $@ && \ + declaration=`grep '^gl_unicase_special_lookup' $(srcdir)/unicase/special-casing-table.h | sed -e 's/register //g'` && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e "/gl_unicase_special_lookup/s/gl_unicase_special_lookup.*/$${declaration};/" $(srcdir)/unicase/special-casing.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +BUILT_SOURCES += unicase/special-casing.h +MOSTLYCLEANFILES += unicase/special-casing.h unicase/special-casing.h-t + +EXTRA_DIST += unicase/special-casing-table.gperf unicase/special-casing.in.h ## end gnulib module unicase/special-casing @@ -3213,6 +3232,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \ -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ @@ -3250,6 +3270,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ + -e 's|@''HAVE_TRUNCATE''@|$(HAVE_TRUNCATE)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ @@ -3269,6 +3290,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ @@ -3291,6 +3313,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ + -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ @@ -3439,6 +3462,50 @@ EXTRA_DIST += $(top_srcdir)/build-aux/useless-if-before-free ## end gnulib module useless-if-before-free +## begin gnulib module utime + + +EXTRA_DIST += utime.c + +EXTRA_libgnu_a_SOURCES += utime.c + +## end gnulib module utime + +## begin gnulib module utime-h + +BUILT_SOURCES += $(UTIME_H) + +# We need the following in order to create <utime.h> when the system +# doesn't have one that works with the given compiler. +if GL_GENERATE_UTIME_H +utime.h: utime.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_UTIME_H''@/$(HAVE_UTIME_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_UTIME_H''@|$(NEXT_UTIME_H)|g' \ + -e 's/@''GNULIB_UTIME''@/$(GNULIB_UTIME)/g' \ + -e 's|@''HAVE_UTIME''@|$(HAVE_UTIME)|g' \ + -e 's|@''REPLACE_UTIME''@|$(REPLACE_UTIME)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/utime.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +utime.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += utime.h utime.h-t + +EXTRA_DIST += utime.in.h + +## end gnulib module utime-h + ## begin gnulib module utimens libgnu_a_SOURCES += utimens.c @@ -3519,6 +3586,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ @@ -3559,6 +3627,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ + -e 's/@''GNULIB_WCSFTIME''@/$(GNULIB_WCSFTIME)/g' \ < $(srcdir)/wchar.in.h | \ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ @@ -3598,6 +3667,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ + -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ | \ @@ -3614,6 +3684,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ + -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ @@ -3650,6 +3721,7 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ diff --git a/lib/Makefile.in b/lib/Makefile.in index 2efa04e..c6e0410 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -27,7 +27,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this file. If not, see <http://www.gnu.org/licenses/>. +# along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that @@ -35,7 +35,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl accept alloca announce-gen base32 bind c-ctype c-strcase c-strcasestr clock-time close connect crypto/md2 crypto/md4 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dirname fcntl flock fnmatch fopen ftello futimens getaddrinfo getline getopt-gnu getpass-gnu getpeername getsockname gettext git-version-gen gitlog-to-changelog gnupload group-member hostent iconv iconv-h inet_ntop intprops inttypes ioctl langinfo libunistring-optional limits-h link listen maintainer-makefile mbiter mbtowc memrchr mkdir mkostemp mkstemp nanosleep open pipe-posix posix_spawn quote quotearg recv regex select send setsockopt signal-h sigpipe sigprocmask snprintf socket spawn-pipe stat stdbool stdint strcase strerror_r-posix strpbrk strptime strtok_r strtoll symlink sys_types timegm tmpdir unicase/u8-tolower unistr/u8-strlen unlink unlocked-io update-copyright utimens vasprintf vsnprintf wcwidth write xmemdup0 xstrndup +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libgnu --source-base=lib/ --m4-base=m4/ --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl accept alloca announce-gen base32 bind c-ctype c-strcase c-strcasestr clock-time close connect dirname fcntl flock fnmatch fopen futimens ftello getaddrinfo getline getopt-gnu getpass-gnu getpeername getsockname gettext gitlog-to-changelog git-version-gen gnupload group-member hostent ioctl iconv iconv-h inet_ntop intprops inttypes langinfo limits-h link listen maintainer-makefile mbiter mbtowc memrchr mkdir mkstemp mkostemp nanosleep crypto/md2 crypto/md4 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 open pipe-posix posix_spawn quote quotearg recv regex select send setsockopt signal-h sigprocmask sigpipe snprintf socket spawn-pipe stat stdbool stdint strcase strerror_r-posix strpbrk strptime strtok_r strtoll symlink sys_types timegm tmpdir unlink unlocked-io update-copyright libunistring-optional unistr/u8-strlen unicase/u8-tolower utimens vasprintf vsnprintf wcwidth write xmemdup0 xstrndup @@ -156,7 +156,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/group-member.m4 \ - $(top_srcdir)/m4/hard-locale.m4 $(top_srcdir)/m4/hostent.m4 \ + $(top_srcdir)/m4/hard-locale.m4 \ + $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/hostent.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_ntop.m4 \ $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ @@ -172,28 +173,29 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/link.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/locale_h.m4 \ - $(top_srcdir)/m4/localeconv.m4 $(top_srcdir)/m4/lock.m4 \ + $(top_srcdir)/m4/localeconv.m4 \ + $(top_srcdir)/m4/localtime-buffer.m4 $(top_srcdir)/m4/lock.m4 \ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lseek.m4 \ $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ - $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ - $(top_srcdir)/m4/mbsrtowcs.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mbtowc.m4 $(top_srcdir)/m4/md4.m4 \ - $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \ - $(top_srcdir)/m4/mkdir.m4 $(top_srcdir)/m4/mkostemp.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/mktime.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ - $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/mbchar.m4 \ + $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrtowc.m4 \ + $(top_srcdir)/m4/mbsinit.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ + $(top_srcdir)/m4/md4.m4 $(top_srcdir)/m4/md5.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memrchr.m4 \ + $(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \ + $(top_srcdir)/m4/mkostemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/mode_t.m4 $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/nanosleep.m4 $(top_srcdir)/m4/netdb_h.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \ - $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/pathmax.m4 \ - $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/pipe2.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posix_spawn.m4 \ - $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/open-cloexec.m4 $(top_srcdir)/m4/open.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/pipe.m4 \ + $(top_srcdir)/m4/pipe2.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/posix_spawn.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \ @@ -231,17 +233,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \ $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlink.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/utimbuf.m4 \ - $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \ - $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \ - $(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/wait-process.m4 \ - $(top_srcdir)/m4/waitpid.m4 $(top_srcdir)/m4/warn-on-use.m4 \ - $(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/m4/wcrtomb.m4 $(top_srcdir)/m4/wctype_h.m4 \ - $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wget.m4 \ - $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/write.m4 \ - $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \ - $(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/utime.m4 \ + $(top_srcdir)/m4/utime_h.m4 $(top_srcdir)/m4/utimens.m4 \ + $(top_srcdir)/m4/utimes.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/vsnprintf.m4 \ + $(top_srcdir)/m4/wait-process.m4 $(top_srcdir)/m4/waitpid.m4 \ + $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/wchar_h.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ + $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wcwidth.m4 \ + $(top_srcdir)/m4/wget.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/write.m4 $(top_srcdir)/m4/xalloc.m4 \ + $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrndup.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -265,13 +268,14 @@ am__libgnu_a_SOURCES_DIST = base32.h base32.c binary-io.h binary-io.c \ fatal-signal.c fd-hook.c fd-safer-flag.c dup-safer-flag.c \ getprogname.h getprogname.c gettext.h gettime.c hard-locale.c \ localcharset.h localcharset.c glthread/lock.h glthread/lock.c \ - mbchar.c mbiter.h mbiter.c minmax.h pipe2.c pipe2-safer.c \ - quotearg.c sig-handler.c size_max.h sockets.h sockets.c \ - spawn-pipe.h spawn-pipe.c w32spawn.h stat-time.c strnlen1.h \ - strnlen1.c sys_socket.c tempname.c glthread/threadlib.c \ - timespec.c tmpdir.h tmpdir.c u64.c unicase/cased.c \ - unicase/empty-prefix-context.c unicase/empty-suffix-context.c \ - unicase/ignorable.c unicase/special-casing.c unicase/tolower.c \ + malloca.c mbchar.c mbiter.h mbiter.c minmax.h pipe2.c \ + pipe2-safer.c quotearg.c sig-handler.c size_max.h sockets.h \ + sockets.c spawn-pipe.h spawn-pipe.c w32spawn.h stat-time.c \ + strnlen1.h strnlen1.c sys_socket.c tempname.c \ + glthread/threadlib.c timespec.c tmpdir.h tmpdir.c u64.c \ + unicase/cased.c unicase/empty-prefix-context.c \ + unicase/empty-suffix-context.c unicase/ignorable.c \ + unicase/special-casing.c unicase/tolower.c \ unicase/u8-casemap.c unicase/u8-tolower.c \ unictype/combiningclass.c unictype/pr_soft_dotted.c \ uninorm/decompose-internal.c uninorm/u8-normalize.c unistd.c \ @@ -307,22 +311,23 @@ am_libgnu_a_OBJECTS = base32.$(OBJEXT) binary-io.$(OBJEXT) \ fd-safer-flag.$(OBJEXT) dup-safer-flag.$(OBJEXT) \ getprogname.$(OBJEXT) gettime.$(OBJEXT) hard-locale.$(OBJEXT) \ localcharset.$(OBJEXT) glthread/lock.$(OBJEXT) \ - mbchar.$(OBJEXT) mbiter.$(OBJEXT) pipe2.$(OBJEXT) \ - pipe2-safer.$(OBJEXT) quotearg.$(OBJEXT) sig-handler.$(OBJEXT) \ - sockets.$(OBJEXT) spawn-pipe.$(OBJEXT) stat-time.$(OBJEXT) \ - strnlen1.$(OBJEXT) sys_socket.$(OBJEXT) tempname.$(OBJEXT) \ - glthread/threadlib.$(OBJEXT) timespec.$(OBJEXT) \ - tmpdir.$(OBJEXT) u64.$(OBJEXT) unicase/cased.$(OBJEXT) \ - $(am__objects_1) $(am__objects_2) unicase/ignorable.$(OBJEXT) \ - unicase/special-casing.$(OBJEXT) $(am__objects_3) \ - unicase/u8-casemap.$(OBJEXT) $(am__objects_4) $(am__objects_5) \ - $(am__objects_6) uninorm/decompose-internal.$(OBJEXT) \ - $(am__objects_7) unistd.$(OBJEXT) dup-safer.$(OBJEXT) \ - fd-safer.$(OBJEXT) pipe-safer.$(OBJEXT) $(am__objects_8) \ - $(am__objects_9) $(am__objects_10) $(am__objects_11) \ - $(am__objects_12) utimens.$(OBJEXT) wait-process.$(OBJEXT) \ - wctype-h.$(OBJEXT) xmalloc.$(OBJEXT) xalloc-die.$(OBJEXT) \ - xsize.$(OBJEXT) xstrndup.$(OBJEXT) + malloca.$(OBJEXT) mbchar.$(OBJEXT) mbiter.$(OBJEXT) \ + pipe2.$(OBJEXT) pipe2-safer.$(OBJEXT) quotearg.$(OBJEXT) \ + sig-handler.$(OBJEXT) sockets.$(OBJEXT) spawn-pipe.$(OBJEXT) \ + stat-time.$(OBJEXT) strnlen1.$(OBJEXT) sys_socket.$(OBJEXT) \ + tempname.$(OBJEXT) glthread/threadlib.$(OBJEXT) \ + timespec.$(OBJEXT) tmpdir.$(OBJEXT) u64.$(OBJEXT) \ + unicase/cased.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ + unicase/ignorable.$(OBJEXT) unicase/special-casing.$(OBJEXT) \ + $(am__objects_3) unicase/u8-casemap.$(OBJEXT) $(am__objects_4) \ + $(am__objects_5) $(am__objects_6) \ + uninorm/decompose-internal.$(OBJEXT) $(am__objects_7) \ + unistd.$(OBJEXT) dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) \ + pipe-safer.$(OBJEXT) $(am__objects_8) $(am__objects_9) \ + $(am__objects_10) $(am__objects_11) $(am__objects_12) \ + utimens.$(OBJEXT) wait-process.$(OBJEXT) wctype-h.$(OBJEXT) \ + xmalloc.$(OBJEXT) xalloc-die.$(OBJEXT) xsize.$(OBJEXT) \ + xstrndup.$(OBJEXT) libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) AM_V_P = $(am__v_P_@AM_V@) @@ -471,6 +476,7 @@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETADDRINFO_LIB = @GETADDRINFO_LIB@ +GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIBC21 = @GLIBC21@ @@ -487,6 +493,7 @@ GNULIB_CHDIR = @GNULIB_CHDIR@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_CONNECT = @GNULIB_CONNECT@ +GNULIB_CTIME = @GNULIB_CTIME@ GNULIB_DPRINTF = @GNULIB_DPRINTF@ GNULIB_DUP = @GNULIB_DUP@ GNULIB_DUP2 = @GNULIB_DUP2@ @@ -494,6 +501,7 @@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPLICIT_BZERO = @GNULIB_EXPLICIT_BZERO@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHMODAT = @GNULIB_FCHMODAT@ @@ -566,6 +574,7 @@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LISTEN = @GNULIB_LISTEN@ GNULIB_LOCALECONV = @GNULIB_LOCALECONV@ +GNULIB_LOCALTIME = @GNULIB_LOCALTIME@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_LSTAT = @GNULIB_LSTAT@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ @@ -611,6 +620,7 @@ GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ +GNULIB_OVERRIDES_STRUCT_STAT = @GNULIB_OVERRIDES_STRUCT_STAT@ GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ @@ -659,6 +669,7 @@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READ = @GNULIB_READ@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ +GNULIB_REALLOCARRAY = @GNULIB_REALLOCARRAY@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ GNULIB_REALPATH = @GNULIB_REALPATH@ GNULIB_RECV = @GNULIB_RECV@ @@ -695,6 +706,7 @@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRERROR_R = @GNULIB_STRERROR_R@ +GNULIB_STRFTIME = @GNULIB_STRFTIME@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ @@ -718,7 +730,9 @@ GNULIB_TIME_R = @GNULIB_TIME_R@ GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TOWCTRANS = @GNULIB_TOWCTRANS@ +GNULIB_TRUNCATE = @GNULIB_TRUNCATE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ +GNULIB_TZSET = @GNULIB_TZSET@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ @@ -726,6 +740,7 @@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_USLEEP = @GNULIB_USLEEP@ +GNULIB_UTIME = @GNULIB_UTIME@ GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ GNULIB_VDPRINTF = @GNULIB_VDPRINTF@ @@ -749,6 +764,7 @@ GNULIB_WCSCOLL = @GNULIB_WCSCOLL@ GNULIB_WCSCPY = @GNULIB_WCSCPY@ GNULIB_WCSCSPN = @GNULIB_WCSCSPN@ GNULIB_WCSDUP = @GNULIB_WCSDUP@ +GNULIB_WCSFTIME = @GNULIB_WCSFTIME@ GNULIB_WCSLEN = @GNULIB_WCSLEN@ GNULIB_WCSNCASECMP = @GNULIB_WCSNCASECMP@ GNULIB_WCSNCAT = @GNULIB_WCSNCAT@ @@ -789,6 +805,7 @@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ @@ -811,12 +828,14 @@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@ +HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ +HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ @@ -837,6 +856,7 @@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ @@ -930,6 +950,7 @@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ +HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_RPMATCH = @HAVE_RPMATCH@ @@ -984,13 +1005,17 @@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ +HAVE_TRUNCATE = @HAVE_TRUNCATE@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ +HAVE_TZSET = @HAVE_TZSET@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_USLEEP = @HAVE_USLEEP@ +HAVE_UTIME = @HAVE_UTIME@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ +HAVE_UTIME_H = @HAVE_UTIME_H@ HAVE_VALGRIND = @HAVE_VALGRIND@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ @@ -1007,6 +1032,7 @@ HAVE_WCSCOLL = @HAVE_WCSCOLL@ HAVE_WCSCPY = @HAVE_WCSCPY@ HAVE_WCSCSPN = @HAVE_WCSCSPN@ HAVE_WCSDUP = @HAVE_WCSDUP@ +HAVE_WCSFTIME = @HAVE_WCSFTIME@ HAVE_WCSLEN = @HAVE_WCSLEN@ HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@ HAVE_WCSNCAT = @HAVE_WCSNCAT@ @@ -1037,6 +1063,8 @@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HOSTENT_LIB = @HOSTENT_LIB@ +HOST_CPU = @HOST_CPU@ +HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ ICONV_CONST = @ICONV_CONST@ ICONV_H = @ICONV_H@ INCLUDE_NEXT = @INCLUDE_NEXT@ @@ -1071,6 +1099,7 @@ LIBS = @LIBS@ LIBSOCKET = @LIBSOCKET@ LIBSSL = @LIBSSL@ LIBSSL_PREFIX = @LIBSSL_PREFIX@ +LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING = @LIBUNISTRING@ LIBUNISTRING_PREFIX = @LIBUNISTRING_PREFIX@ @@ -1142,6 +1171,7 @@ NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ +NEXT_AS_FIRST_DIRECTIVE_UTIME_H = @NEXT_AS_FIRST_DIRECTIVE_UTIME_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ @@ -1175,6 +1205,7 @@ NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@ NEXT_SYS_WAIT_H = @NEXT_SYS_WAIT_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_UTIME_H = @NEXT_UTIME_H@ NEXT_WCHAR_H = @NEXT_WCHAR_H@ NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ @@ -1213,10 +1244,12 @@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ @@ -1325,6 +1358,7 @@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ +REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ @@ -1341,11 +1375,14 @@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ +REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_TZSET = @REPLACE_TZSET@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ +REPLACE_UTIME = @REPLACE_UTIME@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ @@ -1354,6 +1391,7 @@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ +REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ @@ -1384,6 +1422,7 @@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ USE_NLS = @USE_NLS@ +UTIME_H = @UTIME_H@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ VALGRIND_TESTS = @VALGRIND_TESTS@ @@ -1391,6 +1430,8 @@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ +WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ +WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ @@ -1401,7 +1442,6 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -1460,7 +1500,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects -SUBDIRS = +SUBDIRS = noinst_HEADERS = noinst_LIBRARIES = libgnu.a noinst_LTLIBRARIES = @@ -1482,31 +1522,34 @@ EXTRA_DIST = accept.c w32sock.h alloca.c alloca.in.h \ md4.h gl_openssl.h md5.h gl_openssl.h sha1.h gl_openssl.h \ sha256.h gl_openssl.h sha512.h stripslash.c dirname.h \ dosname.h dup2.c errno.in.h error.c error.h exitfail.h fcntl.c \ - fcntl.in.h fd-hook.h flexmember.h float.c float.in.h itold.c \ - flock.c fnmatch.c fnmatch.in.h fnmatch_loop.c fopen.c fseek.c \ - fseeko.c stdio-impl.h fstat.c ftell.c ftello.c stdio-impl.h \ - futimens.c gai_strerror.c getaddrinfo.c getdelim.c \ - getdtablesize.c getgroups.c getline.c getopt.c getopt.in.h \ - getopt1.c getopt_int.h getpass.c getpass.h getpeername.c \ - w32sock.h getsockname.c w32sock.h \ + fcntl.in.h fd-hook.h filename.h flexmember.h float.c \ + float.in.h itold.c flock.c fnmatch.c fnmatch.in.h \ + fnmatch_loop.c fopen.c fseek.c fseeko.c stdio-impl.h fstat.c \ + stat-w32.c stat-w32.h ftell.c ftello.c stdio-impl.h futimens.c \ + gai_strerror.c getaddrinfo.c getdelim.c getdtablesize.c \ + getgroups.c getline.c getopt-cdefs.in.h getopt-core.h \ + getopt-ext.h getopt-pfx-core.h getopt-pfx-ext.h getopt.c \ + getopt.in.h getopt1.c getopt_int.h getpass.c getpass.h \ + getpeername.c w32sock.h getsockname.c w32sock.h \ $(top_srcdir)/build-aux/config.rpath gettimeofday.c \ $(top_srcdir)/build-aux/git-version-gen \ $(top_srcdir)/build-aux/gitlog-to-changelog \ - $(top_srcdir)/GNUmakefile $(top_srcdir)/build-aux/gnupload \ - group-member.c hard-locale.h \ + $(top_srcdir)/GNUmakefile $(top_srcdir)/GNUmakefile \ + $(top_srcdir)/build-aux/gnupload group-member.c hard-locale.h \ $(top_srcdir)/build-aux/config.rpath iconv.in.h inet_ntop.c \ intprops.h inttypes.in.h ioctl.c w32sock.h iswblank.c \ langinfo.in.h libunistring.valgrind limits.in.h link.c \ listen.c w32sock.h config.charset ref-add.sin ref-del.sin \ - locale.in.h localeconv.c lseek.c lstat.c \ - $(top_srcdir)/maint.mk malloc.c mbchar.h mbrtowc.c mbsinit.c \ - mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c mbtowc-impl.h \ - mbtowc.c memchr.c memchr.valgrind memrchr.c mkdir.c mkostemp.c \ - mkstemp.c mktime-internal.h mktime.c mktime-internal.h \ - mktime.c msvc-inval.c msvc-inval.h msvc-nothrow.c \ - msvc-nothrow.h nanosleep.c netdb.in.h netinet_in.in.h \ - nl_langinfo.c open.c pathmax.h pipe.c spawn.c spawn_int.h \ - spawni.c spawn_faction_addclose.c spawn_int.h \ + locale.in.h localeconv.c localtime-buffer.c localtime-buffer.h \ + lseek.c lstat.c $(top_srcdir)/maint.mk $(top_srcdir)/maint.mk \ + malloc.c malloca.h malloca.valgrind mbchar.h mbrtowc.c \ + mbsinit.c mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c \ + mbtowc-impl.h mbtowc.c memchr.c memchr.valgrind memrchr.c \ + mkdir.c mkostemp.c mkstemp.c mktime-internal.h mktime.c \ + mktime-internal.h mktime.c msvc-inval.c msvc-inval.h \ + msvc-nothrow.c msvc-nothrow.h nanosleep.c netdb.in.h \ + netinet_in.in.h nl_langinfo.c open.c pathmax.h pipe.c spawn.c \ + spawn_int.h spawni.c spawn_faction_addclose.c spawn_int.h \ spawn_faction_adddup2.c spawn_int.h spawn_faction_addopen.c \ spawn_int.h spawn_faction_destroy.c spawn_faction_init.c \ spawn_int.h spawnattr_destroy.c spawnattr_init.c \ @@ -1516,12 +1559,9 @@ EXTRA_DIST = accept.c w32sock.h alloca.c alloca.in.h \ regex_internal.h regexec.c sched.in.h secure_getenv.c select.c \ send.c w32sock.h setsockopt.c w32sock.h sig-handler.h \ sigaction.c signal.in.h stdio-write.c sigprocmask.c \ - $(top_srcdir)/build-aux/snippet/_Noreturn.h \ - $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ - $(top_srcdir)/build-aux/snippet/c++defs.h \ - $(top_srcdir)/build-aux/snippet/unused-parameter.h \ - $(top_srcdir)/build-aux/snippet/warn-on-use.h snprintf.c \ - socket.c w32sock.h w32sock.h spawn.in.h stat.c stat-time.h \ + _Noreturn.h arg-nonnull.h c++defs.h unused-parameter.h \ + warn-on-use.h snprintf.c socket.c w32sock.h w32sock.h \ + spawn.in.h stat-w32.c stat-w32.h stat.c stat-time.h \ stdalign.in.h stdbool.in.h stddef.in.h stdint.in.h stdio.in.h \ stdlib.in.h strcasecmp.c strncasecmp.c strchrnul.c \ strchrnul.valgrind strdup.c streq.h strerror.c \ @@ -1535,7 +1575,7 @@ EXTRA_DIST = accept.c w32sock.h alloca.c alloca.in.h \ unicase.in.h unicase/cased.h unicase/caseprop.h \ unictype/bitmap.h unicase/caseprop.h unicase/ignorable.h \ unictype/bitmap.h unicase/special-casing-table.h \ - unicase/special-casing-table.gperf unicase/special-casing.h \ + unicase/special-casing-table.gperf unicase/special-casing.in.h \ unicase/simple-mapping.h unicase/tolower.h unicase/context.h \ unicase/u-casemap.h unicase/unicasemap.h unictype.in.h \ unictype/combiningclass.h unictype/bitmap.h \ @@ -1545,61 +1585,46 @@ EXTRA_DIST = accept.c w32sock.h alloca.c alloca.in.h \ unistd-safer.h unistr.in.h unistr/u-cpy.h unitypes.in.h \ localcharset.h uniwidth.in.h uniwidth/cjk.h unlink.c \ unlocked-io.h $(top_srcdir)/build-aux/update-copyright \ - $(top_srcdir)/build-aux/useless-if-before-free utimens.h \ - asnprintf.c float+.h printf-args.c printf-args.h \ - printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \ - asprintf.c vasprintf.c $(top_srcdir)/build-aux/vc-list-files \ - verify.h vsnprintf.c waitpid.c wchar.in.h wcrtomb.c \ - wctype.in.h wcwidth.c write.c xalloc.h xalloc-oversized.h \ - xmemdup0.c xmemdup0.h - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. + $(top_srcdir)/build-aux/useless-if-before-free utime.c \ + utime.in.h utimens.h asnprintf.c float+.h printf-args.c \ + printf-args.h printf-parse.c printf-parse.h vasnprintf.c \ + vasnprintf.h asprintf.c vasprintf.c \ + $(top_srcdir)/build-aux/vc-list-files verify.h vsnprintf.c \ + waitpid.c wchar.in.h wcrtomb.c wctype.in.h wcwidth.c write.c \ + xalloc.h xalloc-oversized.h xmemdup0.c xmemdup0.h BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h configmake.h $(ERRNO_H) \ - fcntl.h $(FLOAT_H) $(FNMATCH_H) $(GETOPT_H) $(ICONV_H) \ - inttypes.h langinfo.h $(LIMITS_H) locale.h netdb.h \ - $(NETINET_IN_H) $(SCHED_H) signal.h arg-nonnull.h c++defs.h \ - unused-parameter.h warn-on-use.h spawn.h $(STDALIGN_H) \ + fcntl.h $(FLOAT_H) $(FNMATCH_H) $(GETOPT_H) $(GETOPT_CDEFS_H) \ + $(ICONV_H) inttypes.h langinfo.h $(LIMITS_H) locale.h netdb.h \ + $(NETINET_IN_H) $(SCHED_H) signal.h spawn.h $(STDALIGN_H) \ $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h stdlib.h string.h \ strings.h sys/file.h sys/ioctl.h sys/select.h sys/socket.h \ sys/stat.h sys/time.h sys/types.h sys/uio.h sys/wait.h time.h \ $(LIBUNISTRING_UNICASE_H) unicase/special-casing-table.h \ - $(LIBUNISTRING_UNICTYPE_H) $(LIBUNISTRING_UNINORM_H) unistd.h \ - $(LIBUNISTRING_UNISTR_H) $(LIBUNISTRING_UNITYPES_H) \ - $(LIBUNISTRING_UNIWIDTH_H) wchar.h wctype.h + unicase/special-casing.h $(LIBUNISTRING_UNICTYPE_H) \ + $(LIBUNISTRING_UNINORM_H) unistd.h $(LIBUNISTRING_UNISTR_H) \ + $(LIBUNISTRING_UNITYPES_H) $(LIBUNISTRING_UNIWIDTH_H) \ + $(UTIME_H) wchar.h wctype.h SUFFIXES = .sed .sin MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \ arpa/inet.h-t errno.h errno.h-t fcntl.h fcntl.h-t float.h \ - float.h-t fnmatch.h fnmatch.h-t getopt.h getopt.h-t iconv.h \ - iconv.h-t inttypes.h inttypes.h-t langinfo.h langinfo.h-t \ - limits.h limits.h-t locale.h locale.h-t netdb.h netdb.h-t \ - netinet/in.h netinet/in.h-t sched.h sched.h-t signal.h \ - signal.h-t arg-nonnull.h arg-nonnull.h-t c++defs.h c++defs.h-t \ - unused-parameter.h unused-parameter.h-t warn-on-use.h \ - warn-on-use.h-t spawn.h spawn.h-t stdalign.h stdalign.h-t \ - stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \ - stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t \ - strings.h strings.h-t sys/file.h sys/file.h-t sys/ioctl.h \ - sys/ioctl.h-t sys/select.h sys/select.h-t sys/socket.h \ - sys/socket.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \ - sys/types.h sys/types.h-t sys/uio.h sys/uio.h-t sys/wait.h \ - sys/wait.h-t time.h time.h-t unicase.h unicase.h-t \ - unicase/special-casing-table.h-t unictype.h unictype.h-t \ - uninorm.h uninorm.h-t unistd.h unistd.h-t unistr.h unistr.h-t \ - unitypes.h unitypes.h-t uniwidth.h uniwidth.h-t wchar.h \ - wchar.h-t wctype.h wctype.h-t + float.h-t fnmatch.h fnmatch.h-t getopt.h getopt.h-t \ + getopt-cdefs.h getopt-cdefs.h-t iconv.h iconv.h-t inttypes.h \ + inttypes.h-t langinfo.h langinfo.h-t limits.h limits.h-t \ + locale.h locale.h-t netdb.h netdb.h-t netinet/in.h \ + netinet/in.h-t sched.h sched.h-t signal.h signal.h-t spawn.h \ + spawn.h-t stdalign.h stdalign.h-t stdbool.h stdbool.h-t \ + stddef.h stddef.h-t stdint.h stdint.h-t stdio.h stdio.h-t \ + stdlib.h stdlib.h-t string.h string.h-t strings.h strings.h-t \ + sys/file.h sys/file.h-t sys/ioctl.h sys/ioctl.h-t sys/select.h \ + sys/select.h-t sys/socket.h sys/socket.h-t sys/stat.h \ + sys/stat.h-t sys/time.h sys/time.h-t sys/types.h sys/types.h-t \ + sys/uio.h sys/uio.h-t sys/wait.h sys/wait.h-t time.h time.h-t \ + unicase.h unicase.h-t unicase/special-casing-table.h-t \ + unicase/special-casing.h unicase/special-casing.h-t unictype.h \ + unictype.h-t uninorm.h uninorm.h-t unistd.h unistd.h-t \ + unistr.h unistr.h-t unitypes.h unitypes.h-t uniwidth.h \ + uniwidth.h-t utime.h utime.h-t wchar.h wchar.h-t wctype.h \ + wctype.h-t MOSTLYCLEANDIRS = arpa netinet sys sys sys sys sys sys sys CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \ ref-del.sed @@ -1615,16 +1640,16 @@ libgnu_a_SOURCES = base32.h base32.c binary-io.h binary-io.c c-ctype.h \ fatal-signal.c fd-hook.c fd-safer-flag.c dup-safer-flag.c \ getprogname.h getprogname.c gettext.h gettime.c hard-locale.c \ localcharset.h localcharset.c glthread/lock.h glthread/lock.c \ - mbchar.c mbiter.h mbiter.c minmax.h pipe2.c pipe2-safer.c \ - quotearg.c sig-handler.c size_max.h sockets.h sockets.c \ - spawn-pipe.h spawn-pipe.c w32spawn.h stat-time.c strnlen1.h \ - strnlen1.c sys_socket.c tempname.c glthread/threadlib.c \ - timespec.c tmpdir.h tmpdir.c u64.c unicase/cased.c \ - $(am__append_1) $(am__append_2) unicase/ignorable.c \ - unicase/special-casing.c $(am__append_3) unicase/u8-casemap.c \ - $(am__append_4) $(am__append_5) $(am__append_6) \ - uninorm/decompose-internal.c $(am__append_7) unistd.c \ - dup-safer.c fd-safer.c pipe-safer.c $(am__append_8) \ + malloca.c mbchar.c mbiter.h mbiter.c minmax.h pipe2.c \ + pipe2-safer.c quotearg.c sig-handler.c size_max.h sockets.h \ + sockets.c spawn-pipe.h spawn-pipe.c w32spawn.h stat-time.c \ + strnlen1.h strnlen1.c sys_socket.c tempname.c \ + glthread/threadlib.c timespec.c tmpdir.h tmpdir.c u64.c \ + unicase/cased.c $(am__append_1) $(am__append_2) \ + unicase/ignorable.c unicase/special-casing.c $(am__append_3) \ + unicase/u8-casemap.c $(am__append_4) $(am__append_5) \ + $(am__append_6) uninorm/decompose-internal.c $(am__append_7) \ + unistd.c dup-safer.c fd-safer.c pipe-safer.c $(am__append_8) \ $(am__append_9) $(am__append_10) $(am__append_11) \ $(am__append_12) utimens.c wait-process.h wait-process.c \ wctype-h.c xmalloc.c xalloc-die.c xsize.h xsize.c xstrndup.h \ @@ -1634,28 +1659,29 @@ libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@ EXTRA_libgnu_a_SOURCES = accept.c alloca.c bind.c btowc.c close.c \ connect.c stripslash.c dup2.c error.c fcntl.c float.c itold.c \ flock.c fnmatch.c fnmatch_loop.c fopen.c fseek.c fseeko.c \ - fstat.c ftell.c ftello.c futimens.c gai_strerror.c \ + fstat.c stat-w32.c ftell.c ftello.c futimens.c gai_strerror.c \ getaddrinfo.c getdelim.c getdtablesize.c getgroups.c getline.c \ getopt.c getopt1.c getpass.c getpeername.c getsockname.c \ gettimeofday.c group-member.c inet_ntop.c ioctl.c iswblank.c \ - link.c listen.c localeconv.c lseek.c lstat.c malloc.c \ - mbrtowc.c mbsinit.c mbsrtowcs-state.c mbsrtowcs.c mbtowc.c \ - memchr.c memrchr.c mkdir.c mkostemp.c mkstemp.c mktime.c \ - mktime.c msvc-inval.c msvc-nothrow.c nanosleep.c nl_langinfo.c \ - open.c pipe.c spawn.c spawni.c spawn_faction_addclose.c \ - spawn_faction_adddup2.c spawn_faction_addopen.c \ - spawn_faction_destroy.c spawn_faction_init.c \ - spawnattr_destroy.c spawnattr_init.c spawnattr_setflags.c \ - spawnattr_setsigmask.c spawnp.c raise.c rawmemchr.c recv.c \ - regcomp.c regex.c regex_internal.c regexec.c secure_getenv.c \ - select.c send.c setsockopt.c sigaction.c stdio-write.c \ - sigprocmask.c snprintf.c socket.c stat.c strcasecmp.c \ - strncasecmp.c strchrnul.c strdup.c strerror.c \ - strerror-override.c strerror_r.c strndup.c strnlen.c strpbrk.c \ - strptime.c strtok_r.c strtol.c strtoll.c symlink.c time_r.c \ - timegm.c unlink.c asnprintf.c printf-args.c printf-parse.c \ - vasnprintf.c asprintf.c vasprintf.c vsnprintf.c waitpid.c \ - wcrtomb.c wcwidth.c write.c xmemdup0.c + link.c listen.c localeconv.c localtime-buffer.c lseek.c \ + lstat.c malloc.c mbrtowc.c mbsinit.c mbsrtowcs-state.c \ + mbsrtowcs.c mbtowc.c memchr.c memrchr.c mkdir.c mkostemp.c \ + mkstemp.c mktime.c mktime.c msvc-inval.c msvc-nothrow.c \ + nanosleep.c nl_langinfo.c open.c pipe.c spawn.c spawni.c \ + spawn_faction_addclose.c spawn_faction_adddup2.c \ + spawn_faction_addopen.c spawn_faction_destroy.c \ + spawn_faction_init.c spawnattr_destroy.c spawnattr_init.c \ + spawnattr_setflags.c spawnattr_setsigmask.c spawnp.c raise.c \ + rawmemchr.c recv.c regcomp.c regex.c regex_internal.c \ + regexec.c secure_getenv.c select.c send.c setsockopt.c \ + sigaction.c stdio-write.c sigprocmask.c snprintf.c socket.c \ + stat-w32.c stat.c strcasecmp.c strncasecmp.c strchrnul.c \ + strdup.c strerror.c strerror-override.c strerror_r.c strndup.c \ + strnlen.c strpbrk.c strptime.c strtok_r.c strtol.c strtoll.c \ + symlink.c time_r.c timegm.c unlink.c utime.c asnprintf.c \ + printf-args.c printf-parse.c vasnprintf.c asprintf.c \ + vasprintf.c vsnprintf.c waitpid.c wcrtomb.c wcwidth.c write.c \ + xmemdup0.c # Use this preprocessor expression to decide whether #include_next works. # Do not rely on a 'configure'-time test for this, since the expression @@ -1669,13 +1695,29 @@ charset_alias = $(DESTDIR)$(libdir)/charset.alias charset_tmp = $(DESTDIR)$(libdir)/charset.tmp # Because this Makefile snippet defines a variable used by other -# gnulib Makefile snippets, it must be present in all Makefile.am that +# gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. -_NORETURN_H = $(top_srcdir)/build-aux/snippet/_Noreturn.h -ARG_NONNULL_H = arg-nonnull.h -CXXDEFS_H = c++defs.h -UNUSED_PARAMETER_H = unused-parameter.h -WARN_ON_USE_H = warn-on-use.h +_NORETURN_H = $(srcdir)/_Noreturn.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +ARG_NONNULL_H = $(srcdir)/arg-nonnull.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +CXXDEFS_H = $(srcdir)/c++defs.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +UNUSED_PARAMETER_H = $(srcdir)/unused-parameter.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +WARN_ON_USE_H = $(srcdir)/warn-on-use.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -1884,9 +1926,11 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localeconv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localtime-buffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lseek.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbchar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbiter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbrtowc.Po@am__quote@ @@ -1949,6 +1993,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spawni.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spawnp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-time.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-w32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdio-write.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp.Po@am__quote@ @@ -1977,6 +2022,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlink.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utimens.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Po@am__quote@ @@ -2484,7 +2530,7 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) # We need the following in order to create <getopt.h> when the system # doesn't have one that works with the given compiler. -getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) +getopt.h: getopt.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ @@ -2498,6 +2544,13 @@ getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) } > $@-t && \ mv -f $@-t $@ +getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ + < $(srcdir)/getopt-cdefs.in.h; \ + } > $@-t && \ + mv -f $@-t $@ distclean-local: clean-GNUmakefile clean-GNUmakefile: test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile @@ -2781,41 +2834,6 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H < $(srcdir)/signal.in.h; \ } > $@-t && \ mv $@-t $@ -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut -# off. -arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/snippet/c++defs.h \ - > $@-t && \ - mv $@-t $@ -# The unused-parameter.h that gets inserted into generated .h files is the same -# as build-aux/snippet/unused-parameter.h, except that it has the copyright -# header cut off. -unused-parameter.h: $(top_srcdir)/build-aux/snippet/unused-parameter.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ - < $(top_srcdir)/build-aux/snippet/unused-parameter.h \ - > $@-t && \ - mv $@-t $@ -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut -# off. -warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/snippet/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ # We need the following in order to create a replacement for <spawn.h> when # the system doesn't have one. @@ -3096,6 +3114,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ @@ -3114,6 +3133,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ @@ -3126,10 +3146,12 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ @@ -3170,6 +3192,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ @@ -3208,7 +3231,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ + -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ @@ -3229,20 +3253,20 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ - -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ - -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ - -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ - -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ - -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ - -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @@ -3391,6 +3415,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ + -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ @@ -3404,6 +3429,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ + -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ @@ -3468,6 +3494,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ < $(srcdir)/sys_types.in.h; \ } > $@-t && \ mv $@-t $@ @@ -3516,24 +3543,31 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ + -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \ + -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \ -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRFTIME''@/$(GNULIB_STRFTIME)/g' \ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ + -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \ + -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ + -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ + -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|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' \ @@ -3552,10 +3586,20 @@ unicase.h: unicase.in.h } > $@-t && \ mv -f $@-t $@ -unicase/special-casing-table.h: $(srcdir)/unicase/special-casing-table.gperf +$(srcdir)/unicase/special-casing-table.h: $(srcdir)/unicase/special-casing-table.gperf $(V_GPERF)$(GPERF) -m 10 $(srcdir)/unicase/special-casing-table.gperf > $(srcdir)/unicase/special-casing-table.h-t && \ mv $(srcdir)/unicase/special-casing-table.h-t $(srcdir)/unicase/special-casing-table.h +# Generate special-casing.h with a declaration that depends on the gperf version. +unicase/special-casing.h: unicase/special-casing.in.h unicase/special-casing-table.h + $(AM_V_at)$(MKDIR_P) unicase + $(AM_V_GEN)rm -f $@-t $@ && \ + declaration=`grep '^gl_unicase_special_lookup' $(srcdir)/unicase/special-casing-table.h | sed -e 's/register //g'` && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e "/gl_unicase_special_lookup/s/gl_unicase_special_lookup.*/$${declaration};/" $(srcdir)/unicase/special-casing.in.h; \ + } > $@-t && \ + mv -f $@-t $@ + unictype.h: unictype.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -3623,6 +3667,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \ -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ @@ -3660,6 +3705,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ + -e 's|@''HAVE_TRUNCATE''@|$(HAVE_TRUNCATE)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ @@ -3679,6 +3725,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ @@ -3701,6 +3748,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ + -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ @@ -3735,6 +3783,29 @@ uniwidth.h: uniwidth.in.h } > $@-t && \ mv -f $@-t $@ +# We need the following in order to create <utime.h> when the system +# doesn't have one that works with the given compiler. +@GL_GENERATE_UTIME_H_TRUE@utime.h: utime.in.h $(top_builddir)/config.status +@GL_GENERATE_UTIME_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_UTIME_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_UTIME_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's/@''HAVE_UTIME_H''@/$(HAVE_UTIME_H)/g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's|@''NEXT_UTIME_H''@|$(NEXT_UTIME_H)|g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's/@''GNULIB_UTIME''@/$(GNULIB_UTIME)/g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's|@''HAVE_UTIME''@|$(HAVE_UTIME)|g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e 's|@''REPLACE_UTIME''@|$(REPLACE_UTIME)|g' \ +@GL_GENERATE_UTIME_H_TRUE@ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ +@GL_GENERATE_UTIME_H_TRUE@ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ +@GL_GENERATE_UTIME_H_TRUE@ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ +@GL_GENERATE_UTIME_H_TRUE@ < $(srcdir)/utime.in.h; \ +@GL_GENERATE_UTIME_H_TRUE@ } > $@-t && \ +@GL_GENERATE_UTIME_H_TRUE@ mv $@-t $@ +@GL_GENERATE_UTIME_H_FALSE@utime.h: $(top_builddir)/config.status +@GL_GENERATE_UTIME_H_FALSE@ rm -f $@ + # We need the following in order to create <wchar.h> when the system # version does not work standalone. wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) @@ -3747,6 +3818,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ @@ -3787,6 +3859,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ + -e 's/@''GNULIB_WCSFTIME''@/$(GNULIB_WCSFTIME)/g' \ < $(srcdir)/wchar.in.h | \ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ @@ -3826,6 +3899,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ + -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ | \ @@ -3842,6 +3916,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ + -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ @@ -3859,6 +3934,7 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h new file mode 100644 index 0000000..c44ad89 --- /dev/null +++ b/lib/_Noreturn.h @@ -0,0 +1,10 @@ +#if !defined _Noreturn && __STDC_VERSION__ < 201112 +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif diff --git a/lib/accept.c b/lib/accept.c index 08bb4d9..9659c71 100644 --- a/lib/accept.c +++ b/lib/accept.c @@ -1,6 +1,6 @@ /* accept.c --- wrappers for Windows accept function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/alloca.in.h b/lib/alloca.in.h index c3dc38a..5ad8af8 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h @@ -1,6 +1,6 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2017 Free Software Foundation, + Copyright (C) 1995, 1999, 2001-2004, 2006-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see - <http://www.gnu.org/licenses/>. + <https://www.gnu.org/licenses/>. */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H diff --git a/lib/arg-nonnull.h b/lib/arg-nonnull.h new file mode 100644 index 0000000..5f03408 --- /dev/null +++ b/lib/arg-nonnull.h @@ -0,0 +1,26 @@ +/* A C macro for declaring that specific arguments must not be NULL. + Copyright (C) 2009-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools + that the values passed as arguments n, ..., m must be non-NULL pointers. + n = 1 stands for the first argument, n = 2 for the second argument etc. */ +#ifndef _GL_ARG_NONNULL +# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 +# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) +# else +# define _GL_ARG_NONNULL(params) +# endif +#endif diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h index dc3d2bd..3253d79 100644 --- a/lib/arpa_inet.in.h +++ b/lib/arpa_inet.in.h @@ -1,6 +1,6 @@ /* A GNU-like <arpa/inet.h>. - Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_ARPA_INET_H diff --git a/lib/array-mergesort.h b/lib/array-mergesort.h index f00dea2..6988dfe 100644 --- a/lib/array-mergesort.h +++ b/lib/array-mergesort.h @@ -1,5 +1,5 @@ /* Stable-sorting of an array using mergesort. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* This file implements stable sorting of an array, using the mergesort algorithm. diff --git a/lib/asnprintf.c b/lib/asnprintf.c index 14ab3e8..2298455 100644 --- a/lib/asnprintf.c +++ b/lib/asnprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/asprintf.c b/lib/asprintf.c index 6635f49..061072f 100644 --- a/lib/asprintf.c +++ b/lib/asprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007, 2009-2017 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/base32.c b/lib/base32.c index 53a2d23..20c85ec 100644 --- a/lib/base32.c +++ b/lib/base32.c @@ -1,5 +1,5 @@ /* base32.c -- Encode binary data using printable characters. - Copyright (C) 1999-2001, 2004-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1999-2001, 2004-2006, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,11 +12,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Adapted from Simon Josefsson's base64 code by Gijs van Tulder. * - * See also RFC 4648 <http://www.ietf.org/rfc/rfc4648.txt>. + * See also RFC 4648 <https://www.ietf.org/rfc/rfc4648.txt>. * * Be careful with error checking. Here is how you would typically * use these functions: diff --git a/lib/base32.h b/lib/base32.h index c4e550f..6c408e8 100644 --- a/lib/base32.h +++ b/lib/base32.h @@ -1,5 +1,5 @@ /* base32.h -- Encode binary data using printable characters. - Copyright (C) 2004-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2004-2006, 2009-2018 Free Software Foundation, Inc. Adapted from Simon Josefsson's base64 code by Gijs van Tulder. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef BASE32_H # define BASE32_H diff --git a/lib/basename-lgpl.c b/lib/basename-lgpl.c index 54d3cc0..33f9994 100644 --- a/lib/basename-lgpl.c +++ b/lib/basename-lgpl.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2017 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/basename.c b/lib/basename.c index 0353635..02adb8c 100644 --- a/lib/basename.c +++ b/lib/basename.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2017 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/binary-io.c b/lib/binary-io.c index d828bcd..f9cc4dd 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c @@ -1,4 +1,37 @@ +/* Binary mode I/O. + Copyright 2017-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + #include <config.h> + #define BINARY_IO_INLINE _GL_EXTERN_INLINE #include "binary-io.h" -typedef int dummy; + +#if defined __DJGPP__ || defined __EMX__ +# include <errno.h> +# include <unistd.h> + +int +__gl_setmode_check (int fd) +{ + if (isatty (fd)) + { + errno = EINVAL; + return -1; + } + else + return 0; +} +#endif diff --git a/lib/binary-io.h b/lib/binary-io.h index f766439..cce1301 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -1,5 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _BINARY_H #define _BINARY_H @@ -33,15 +33,12 @@ _GL_INLINE_HEADER_BEGIN # define BINARY_IO_INLINE _GL_INLINE #endif -/* set_binary_mode (fd, mode) - sets the binary/text I/O mode of file descriptor fd to the given mode - (must be O_BINARY or O_TEXT) and returns the previous mode. */ #if O_BINARY # if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ # include <io.h> /* declares setmode() */ -# define set_binary_mode setmode +# define __gl_setmode setmode # else -# define set_binary_mode _setmode +# define __gl_setmode _setmode # undef fileno # define fileno _fileno # endif @@ -50,7 +47,7 @@ _GL_INLINE_HEADER_BEGIN /* Use a function rather than a macro, to avoid gcc warnings "warning: statement with no effect". */ BINARY_IO_INLINE int -set_binary_mode (int fd, int mode) +__gl_setmode (int fd, int mode) { (void) fd; (void) mode; @@ -58,18 +55,29 @@ set_binary_mode (int fd, int mode) } #endif -/* SET_BINARY (fd); - changes the file descriptor fd to perform binary I/O. */ #if defined __DJGPP__ || defined __EMX__ -# include <unistd.h> /* declares isatty() */ - /* Avoid putting stdin/stdout in binary mode if it is connected to - the console, because that would make it impossible for the user - to interrupt the program through Ctrl-C or Ctrl-Break. */ -# define SET_BINARY(fd) ((void) (!isatty (fd) ? (set_binary_mode (fd, O_BINARY), 0) : 0)) +extern int __gl_setmode_check (int); #else -# define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) +BINARY_IO_INLINE int +__gl_setmode_check (int fd) { return 0; } #endif +/* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. + Return the old mode if successful, -1 (setting errno) on failure. + Ordinarily this function would be called 'setmode', since that is + its name on MS-Windows, but it is called 'set_binary_mode' here + to avoid colliding with a BSD function of another name. */ + +BINARY_IO_INLINE int +set_binary_mode (int fd, int mode) +{ + int r = __gl_setmode_check (fd); + return r != 0 ? r : __gl_setmode (fd, mode); +} + +/* This macro is obsolescent. */ +#define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) + _GL_INLINE_HEADER_END #endif /* _BINARY_H */ @@ -1,6 +1,6 @@ /* bind.c --- wrappers for Windows bind function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/btowc.c b/lib/btowc.c index 214d2b7..54124b2 100644 --- a/lib/btowc.c +++ b/lib/btowc.c @@ -1,5 +1,5 @@ /* Convert unibyte character to wide character. - Copyright (C) 2008, 2010-2017 Free Software Foundation, Inc. + Copyright (C) 2008, 2010-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/c++defs.h b/lib/c++defs.h new file mode 100644 index 0000000..72ff1ff --- /dev/null +++ b/lib/c++defs.h @@ -0,0 +1,316 @@ +/* C++ compatible function declaration macros. + Copyright (C) 2010-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _GL_CXXDEFS_H +#define _GL_CXXDEFS_H + +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + +/* The three most frequent use cases of these macros are: + + * For providing a substitute for a function that is missing on some + platforms, but is declared and works fine on the platforms on which + it exists: + + #if @GNULIB_FOO@ + # if !@HAVE_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on all platforms, + but is broken/insufficient and needs to be replaced on some platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on some platforms + but is broken/insufficient and needs to be replaced on some of them and + is additionally either missing or undeclared on some other platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif +*/ + +/* _GL_EXTERN_C declaration; + performs the declaration with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C extern "C" +#else +# define _GL_EXTERN_C extern +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); + declares a replacement function, named rpl_func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype rpl_func parameters_and_attributes + +/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); + declares the system function, named func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype func parameters_and_attributes + +/* _GL_CXXALIAS_RPL (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to rpl_func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>(::rpl_func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to the system provided function func, if GNULIB_NAMESPACE + is defined. + Example: + _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>(::func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function is picked among a set of overloaded functions, + namely the one with rettype2 and parameters2. Two consecutive casts + are used to silence the "cannot find a match" and "invalid conversion" + errors that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN (func); + causes a warning to be emitted when ::func is used but not when + GNULIB_NAMESPACE::func is used. func must be defined without overloaded + variants. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN(func) \ + _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN_1(func,namespace) \ + _GL_CXXALIASWARN_2 (func, namespace) +/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, + we enable the warning only when not optimizing. */ +# if !__OPTIMIZE__ +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_WARN_ON_USE (func, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN_2(func,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN(func) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); + causes a warning to be emitted when the given overloaded variant of ::func + is used but not when GNULIB_NAMESPACE::func is used. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ + GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ + _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) +/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, + we enable the warning only when not optimizing. */ +# if !__OPTIMIZE__ +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +#endif /* _GL_CXXDEFS_H */ diff --git a/lib/c-ctype.h b/lib/c-ctype.h index bcdba6b..d55d4f6 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -5,7 +5,7 @@ <ctype.h> functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000-2003, 2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, see <http://www.gnu.org/licenses/>. */ +along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef C_CTYPE_H #define C_CTYPE_H diff --git a/lib/c-strcase.h b/lib/c-strcase.h index c82dab1..41f439e 100644 --- a/lib/c-strcase.h +++ b/lib/c-strcase.h @@ -1,5 +1,5 @@ /* Case-insensitive string comparison functions in C locale. - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2017 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef C_STRCASE_H #define C_STRCASE_H diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c index 5bce873..2b1ac99 100644 --- a/lib/c-strcasecmp.c +++ b/lib/c-strcasecmp.c @@ -1,5 +1,5 @@ /* c-strcasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h index aa5e71f..9bde9de 100644 --- a/lib/c-strcaseeq.h +++ b/lib/c-strcaseeq.h @@ -1,5 +1,5 @@ /* Optimized case-insensitive string comparison in C locale. - Copyright (C) 2001-2002, 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ diff --git a/lib/c-strcasestr.c b/lib/c-strcasestr.c index f1ff254..5865d7b 100644 --- a/lib/c-strcasestr.c +++ b/lib/c-strcasestr.c @@ -1,5 +1,5 @@ /* c-strcasestr.c -- case insensitive substring search in C locale - Copyright (C) 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2005. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/c-strcasestr.h b/lib/c-strcasestr.h index 4f87e2f..c5d7df2 100644 --- a/lib/c-strcasestr.h +++ b/lib/c-strcasestr.h @@ -1,5 +1,5 @@ /* Case-insensitive searching in a string in C locale. - Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef C_STRCASESTR_H #define C_STRCASESTR_H diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index ada62d7..8151c1a 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c @@ -1,5 +1,5 @@ /* c-strncasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/cloexec.c b/lib/cloexec.c index a5ad0b5..238ab18 100644 --- a/lib/cloexec.c +++ b/lib/cloexec.c @@ -1,6 +1,6 @@ -/* closexec.c - set or clear the close-on-exec descriptor flag +/* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. The code is taken from glibc/manual/llio.texi */ diff --git a/lib/cloexec.h b/lib/cloexec.h index 2990e82..5902805 100644 --- a/lib/cloexec.h +++ b/lib/cloexec.h @@ -1,6 +1,6 @@ -/* closexec.c - set or clear the close-on-exec descriptor flag +/* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. */ diff --git a/lib/close.c b/lib/close.c index 3e45187..01c326a 100644 --- a/lib/close.c +++ b/lib/close.c @@ -1,5 +1,5 @@ /* close replacement. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -22,7 +22,9 @@ #include <errno.h> #include "fd-hook.h" -#include "msvc-inval.h" +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif #undef close diff --git a/lib/config.charset b/lib/config.charset index 8bedbf3..7101403 100644 --- a/lib/config.charset +++ b/lib/config.charset @@ -1,7 +1,7 @@ #! /bin/sh # Output a system dependent table of character encoding aliases. # -# Copyright (C) 2000-2004, 2006-2017 Free Software Foundation, Inc. +# Copyright (C) 2000-2004, 2006-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, see <http://www.gnu.org/licenses/>. +# with this program; if not, see <https://www.gnu.org/licenses/>. # # The table consists of lines of the form # ALIAS CANONICAL diff --git a/lib/connect.c b/lib/connect.c index 9e2a36e..300a594 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -1,6 +1,6 @@ /* connect.c --- wrappers for Windows connect function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/dirname-lgpl.c b/lib/dirname-lgpl.c index b549ca9..a40f6a9 100644 --- a/lib/dirname-lgpl.c +++ b/lib/dirname-lgpl.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2017 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/dirname.c b/lib/dirname.c index ed57557..766f862 100644 --- a/lib/dirname.c +++ b/lib/dirname.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2017 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/dirname.h b/lib/dirname.h index dbf920b..69aeb86 100644 --- a/lib/dirname.h +++ b/lib/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2017 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 diff --git a/lib/dosname.h b/lib/dosname.h index dd5c177..66486d5 100644 --- a/lib/dosname.h +++ b/lib/dosname.h @@ -1,6 +1,6 @@ /* File names on MS-DOS/Windows systems. - Copyright (C) 2000-2001, 2004-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. From Paul Eggert and Jim Meyering. */ diff --git a/lib/dup-safer-flag.c b/lib/dup-safer-flag.c index 53a6ac9..aa28194 100644 --- a/lib/dup-safer-flag.c +++ b/lib/dup-safer-flag.c @@ -1,7 +1,7 @@ /* Duplicate a file descriptor result, avoiding clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. - Copyright (C) 2001, 2004-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Eric Blake. */ diff --git a/lib/dup-safer.c b/lib/dup-safer.c index d00997c..1f1679e 100644 --- a/lib/dup-safer.c +++ b/lib/dup-safer.c @@ -1,6 +1,6 @@ /* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 2004-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ @@ -35,10 +35,39 @@ # define WIN32_LEAN_AND_MEAN # include <windows.h> -# include "msvc-inval.h" +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static int +dup2_nothrow (int fd, int desired_fd) +{ + int result; + + TRY_MSVC_INVAL + { + result = dup2 (fd, desired_fd); + } + CATCH_MSVC_INVAL + { + errno = EBADF; + result = -1; + } + DONE_MSVC_INVAL; + + return result; +} +# else +# define dup2_nothrow dup2 +# endif static int ms_windows_dup2 (int fd, int desired_fd) @@ -59,23 +88,14 @@ ms_windows_dup2 (int fd, int desired_fd) } /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: - http://bugs.winehq.org/show_bug.cgi?id=21289 */ + https://bugs.winehq.org/show_bug.cgi?id=21289 */ if (desired_fd < 0) { errno = EBADF; return -1; } - TRY_MSVC_INVAL - { - result = dup2 (fd, desired_fd); - } - CATCH_MSVC_INVAL - { - errno = EBADF; - result = -1; - } - DONE_MSVC_INVAL; + result = dup2_nothrow (fd, desired_fd); if (result == 0) result = desired_fd; diff --git a/lib/errno.in.h b/lib/errno.in.h index 13194f9..8d2f307 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -1,6 +1,6 @@ /* A POSIX-like <errno.h>. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_ERRNO_H diff --git a/lib/error.c b/lib/error.c index 535d8a2..81788c7 100644 --- a/lib/error.c +++ b/lib/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ @@ -98,28 +98,32 @@ extern void __error_at_line (int status, int errnum, const char *file_name, # define WIN32_LEAN_AND_MEAN # include <windows.h> /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif # endif /* The gnulib override of fcntl is not needed in this file. */ # undef fcntl -# if !HAVE_DECL_STRERROR_R +# if !(GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R) # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif # if STRERROR_R_CHAR_P -char *strerror_r (); +char *strerror_r (int errnum, char *buf, size_t buflen); # else -int strerror_r (); +int strerror_r (int errnum, char *buf, size_t buflen); # endif # endif #define program_name getprogname () -# if HAVE_STRERROR_R || defined strerror_r +# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r -# endif /* HAVE_STRERROR_R || defined strerror_r */ +# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ #if !_LIBC @@ -172,9 +176,9 @@ print_errno_message (int errnum) { char const *s; -#if defined HAVE_STRERROR_R || _LIBC +#if _LIBC || GNULIB_STRERROR_R_POSIX || defined HAVE_STRERROR_R char errbuf[1024]; -# if _LIBC || STRERROR_R_CHAR_P +# if _LIBC || (!GNULIB_STRERROR_R_POSIX && STRERROR_R_CHAR_P) s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) @@ -268,7 +272,6 @@ error_tail (int status, int errnum, const char *message, va_list args) else #endif vfprintf (stderr, message, args); - va_end (args); ++error_message_count; if (errnum) @@ -318,6 +321,7 @@ error (int status, int errnum, const char *message, ...) va_start (args, message); error_tail (status, errnum, message, args); + va_end (args); #ifdef _LIBC _IO_funlockfile (stderr); @@ -388,6 +392,7 @@ error_at_line (int status, int errnum, const char *file_name, va_start (args, message); error_tail (status, errnum, message, args); + va_end (args); #ifdef _LIBC _IO_funlockfile (stderr); diff --git a/lib/error.h b/lib/error.h index ef024d9..36401e1 100644 --- a/lib/error.h +++ b/lib/error.h @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995-1997, 2003, 2006, 2008-2017 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _ERROR_H #define _ERROR_H 1 diff --git a/lib/exitfail.c b/lib/exitfail.c index 524eb5c..19c5cba 100644 --- a/lib/exitfail.c +++ b/lib/exitfail.c @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/exitfail.h b/lib/exitfail.h index 895511f..a42057b 100644 --- a/lib/exitfail.h +++ b/lib/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,6 +13,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ extern int volatile exit_failure; diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c index bb159d7..9d795f7 100644 --- a/lib/fatal-signal.c +++ b/lib/fatal-signal.c @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/fatal-signal.h b/lib/fatal-signal.h index 45fa71c..41b4af7 100644 --- a/lib/fatal-signal.h +++ b/lib/fatal-signal.h @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifdef __cplusplus diff --git a/lib/fcntl.c b/lib/fcntl.c index afe1546..b8cb271 100644 --- a/lib/fcntl.c +++ b/lib/fcntl.c @@ -1,6 +1,6 @@ /* Provide file descriptor control. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>. */ @@ -38,7 +38,11 @@ # include <windows.h> /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif /* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ # define OPEN_MAX_MAX 0x10000 diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 4a1d40a..719a54d 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -1,6 +1,6 @@ /* Like <fcntl.h>, but with non-working flags defined to 0. - Copyright (C) 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2006-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ @@ -213,7 +213,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " #endif #ifndef O_CLOEXEC -# define O_CLOEXEC 0 +# define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ +# define GNULIB_defined_O_CLOEXEC 1 +#else +# define GNULIB_defined_O_CLOEXEC 0 #endif #ifndef O_DIRECT diff --git a/lib/fd-hook.c b/lib/fd-hook.c index ab5847a..95a0662 100644 --- a/lib/fd-hook.c +++ b/lib/fd-hook.c @@ -1,5 +1,5 @@ -/* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2017 Free Software Foundation, Inc. +/* Hook for making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/fd-hook.h b/lib/fd-hook.h index fe0d1b0..dbc5b67 100644 --- a/lib/fd-hook.h +++ b/lib/fd-hook.h @@ -1,5 +1,5 @@ -/* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2017 Free Software Foundation, Inc. +/* Hook for making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef FD_HOOK_H diff --git a/lib/fd-safer-flag.c b/lib/fd-safer-flag.c index 59071ef..b757484 100644 --- a/lib/fd-safer-flag.c +++ b/lib/fd-safer-flag.c @@ -1,7 +1,7 @@ /* Adjust a file descriptor result so that it avoids clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. - Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Eric Blake. */ diff --git a/lib/fd-safer.c b/lib/fd-safer.c index da09128..1ea9a49 100644 --- a/lib/fd-safer.c +++ b/lib/fd-safer.c @@ -1,6 +1,6 @@ /* Return a safer copy of a file descriptor. - Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/filename.h b/lib/filename.h new file mode 100644 index 0000000..a8127e8 --- /dev/null +++ b/lib/filename.h @@ -0,0 +1,54 @@ +/* Basic filename support macros. + Copyright (C) 2001-2004, 2007-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _FILENAME_H +#define _FILENAME_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Pathname support. + ISSLASH(C) tests whether C is a directory separator character. + IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not, + it may be concatenated to a directory pathname. + IS_PATH_WITH_DIR(P) tests whether P contains a directory specification. + */ +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + /* Native Windows, Cygwin, OS/2, DOS */ +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +# define HAS_DEVICE(P) \ + ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ + && (P)[1] == ':') +# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P)) +# define IS_PATH_WITH_DIR(P) \ + (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P)) +# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0) +#else + /* Unix */ +# define ISSLASH(C) ((C) == '/') +# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0]) +# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL) +# define FILE_SYSTEM_PREFIX_LEN(P) 0 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _FILENAME_H */ diff --git a/lib/flexmember.h b/lib/flexmember.h index c71ea65..7e3f598 100644 --- a/lib/flexmember.h +++ b/lib/flexmember.h @@ -1,19 +1,22 @@ /* Sizes of structs with flexible array members. - Copyright 2016-2017 Free Software Foundation, Inc. + Copyright 2016-2018 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is part of the GNU C Library. - This program is distributed in the hope that it will be useful, + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. Written by Paul Eggert. */ diff --git a/lib/float+.h b/lib/float+.h index ba8ecb7..2cb858f 100644 --- a/lib/float+.h +++ b/lib/float+.h @@ -1,5 +1,5 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _FLOATPLUS_H #define _FLOATPLUS_H diff --git a/lib/float.c b/lib/float.c index b9103ec..7caca83 100644 --- a/lib/float.c +++ b/lib/float.c @@ -1,5 +1,5 @@ /* Auxiliary definitions for <float.h>. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/float.in.h b/lib/float.in.h index 3e01200..2cdbd12 100644 --- a/lib/float.in.h +++ b/lib/float.in.h @@ -1,6 +1,6 @@ /* A correct <float.h>. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_FLOAT_H @@ -62,8 +62,8 @@ /* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of precision in the compiler but 64 bits of precision at runtime. See - <http://lists.gnu.org/archive/html/bug-gnulib/2008-07/msg00063.html>. */ -#if defined __i386__ && defined __FreeBSD__ + <https://lists.gnu.org/r/bug-gnulib/2008-07/msg00063.html>. */ +#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) /* Number of mantissa units, in base FLT_RADIX. */ # undef LDBL_MANT_DIG # define LDBL_MANT_DIG 64 @@ -81,7 +81,7 @@ # define LDBL_MAX_EXP 16384 /* Minimum positive normalized number. */ # undef LDBL_MIN -# define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */ +# define LDBL_MIN 3.362103143112093506262677817321752E-4932L /* = 0x1p-16382L */ /* Maximum representable finite number. */ # undef LDBL_MAX /* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }. diff --git a/lib/flock.c b/lib/flock.c index 563955e..1925783 100644 --- a/lib/flock.c +++ b/lib/flock.c @@ -1,12 +1,12 @@ /* Emulate flock on platforms that lack it, primarily Windows and MinGW. This is derived from sqlite3 sources. - http://www.sqlite.org/cvstrac/rlog?f=sqlite/src/os_win.c - http://www.sqlite.org/copyright.html + https://www.sqlite.org/src/finfo?name=src/os_win.c + https://www.sqlite.org/copyright.html Written by Richard W.M. Jones <rjones.at.redhat.com> - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public @@ -19,7 +19,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> #include <sys/file.h> @@ -33,7 +33,11 @@ # include <errno.h> /* _get_osfhandle */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif /* Determine the current size of a file. Because the other braindead * APIs we'll call need lower/upper 32 bit pairs, keep the file size diff --git a/lib/fnmatch.c b/lib/fnmatch.c index 709d4ff..0fa0a3d 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993, 1996-2007, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> @@ -65,6 +65,14 @@ extern int fnmatch (const char *pattern, const char *string, int flags); #include "flexmember.h" +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + /* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */ #define NO_LEADING_PERIOD(flags) \ ((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD)) diff --git a/lib/fnmatch.in.h b/lib/fnmatch.in.h index 1782ad2..2464449 100644 --- a/lib/fnmatch.in.h +++ b/lib/fnmatch.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2017 Free +/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _FNMATCH_H #define _FNMATCH_H 1 diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index 97a1b9a..dcf5a15 100644 --- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993, 1996-2006, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2006, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Match STRING against the file name pattern PATTERN, returning zero if it matches, nonzero if not. */ @@ -960,7 +960,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, new_no_leading_period = true; break; } - /* FALLTHROUGH */ + FALLTHROUGH; default: normal_match: if (n == string_end || c != FOLD ((UCHAR) *n)) @@ -1114,8 +1114,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L_('*'): if (FCT (p, string, string_end, no_leading_period, flags) == 0) return 0; - /* FALLTHROUGH */ - + FALLTHROUGH; case L_('+'): do { @@ -1151,8 +1150,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L_('?'): if (FCT (p, string, string_end, no_leading_period, flags) == 0) return 0; - /* FALLTHROUGH */ - + FALLTHROUGH; case L_('@'): do /* I cannot believe it but 'strcat' is actually acceptable diff --git a/lib/fopen.c b/lib/fopen.c index 1cefd85..409f54f 100644 --- a/lib/fopen.c +++ b/lib/fopen.c @@ -1,5 +1,5 @@ /* Open a stream to a file. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff --git a/lib/fseek.c b/lib/fseek.c index d9e2e84..e0b5877 100644 --- a/lib/fseek.c +++ b/lib/fseek.c @@ -1,5 +1,5 @@ /* An fseek() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/fseeko.c b/lib/fseeko.c index 5ae106f..56cdc59 100644 --- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -1,5 +1,5 @@ /* An fseeko() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -80,7 +80,7 @@ fseeko (FILE *fp, off_t offset, int whence) #elif defined __minix /* Minix */ if (fp_->_ptr == fp_->_buf && (fp_->_ptr == NULL || fp_->_count == 0)) -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ if (fp_->_ptr == fp_->_base && (fp_->_ptr == NULL || fp_->_cnt == 0)) #elif defined __UCLIBC__ /* uClibc */ @@ -150,7 +150,7 @@ fseeko (FILE *fp, off_t offset, int whence) fp_->_flags &= ~__SEOF; #elif defined __EMX__ /* emx+gcc */ fp->_flags &= ~_IOEOF; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ fp_->_flag &= ~_IOEOF; #elif defined __MINT__ /* Atari FreeMiNT */ fp->__offset = pos; diff --git a/lib/fstat.c b/lib/fstat.c index a5aabc5..c143d46 100644 --- a/lib/fstat.c +++ b/lib/fstat.c @@ -1,5 +1,5 @@ /* fstat() replacement. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* If the user's config.h happens to include <sys/stat.h>, let it include only the system's <sys/stat.h> here, so that orig_fstat doesn't recurse to @@ -23,54 +23,41 @@ /* Get the original definition of fstat. It might be defined as a macro. */ #include <sys/types.h> #include <sys/stat.h> -#if _GL_WINDOWS_64_BIT_ST_SIZE -# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define stat _stati64 -# undef fstat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define fstat _fstati64 -#endif #undef __need_system_sys_stat_h +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# define WINDOWS_NATIVE +#endif + +#if !defined WINDOWS_NATIVE + static int orig_fstat (int fd, struct stat *buf) { return fstat (fd, buf); } +#endif + /* Specification. */ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ #include "sys/stat.h" +#include "stat-time.h" + #include <errno.h> #include <unistd.h> - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -# include "msvc-inval.h" -#endif - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -static int -fstat_nothrow (int fd, struct stat *buf) -{ - int result; - - TRY_MSVC_INVAL - { - result = orig_fstat (fd, buf); - } - CATCH_MSVC_INVAL - { - result = -1; - errno = EBADF; - } - DONE_MSVC_INVAL; - - return result; -} -#else -# define fstat_nothrow orig_fstat +#ifdef WINDOWS_NATIVE +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif +# include "stat-w32.h" #endif int @@ -84,5 +71,20 @@ rpl_fstat (int fd, struct stat *buf) return stat (name, buf); #endif - return fstat_nothrow (fd, buf); +#ifdef WINDOWS_NATIVE + /* Fill the fields ourselves, because the original fstat function returns + values for st_atime, st_mtime, st_ctime that depend on the current time + zone. See + <https://lists.gnu.org/r/bug-gnulib/2017-04/msg00134.html> */ + HANDLE h = (HANDLE) _get_osfhandle (fd); + + if (h == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + return _gl_fstat_by_handle (h, NULL, buf); +#else + return stat_time_normalize (orig_fstat (fd, buf), buf); +#endif } diff --git a/lib/ftell.c b/lib/ftell.c index a5c9489..74a1da8 100644 --- a/lib/ftell.c +++ b/lib/ftell.c @@ -1,5 +1,5 @@ /* An ftell() function that works around platform bugs. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/ftello.c b/lib/ftello.c index 298255a..495c254 100644 --- a/lib/ftello.c +++ b/lib/ftello.c @@ -1,5 +1,5 @@ /* An ftello() function that works around platform bugs. - Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/futimens.c b/lib/futimens.c index 213e9b7..abcba9e 100644 --- a/lib/futimens.c +++ b/lib/futimens.c @@ -1,5 +1,5 @@ /* Set the access and modification time of an open fd. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Eric Blake */ diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c index 26b74a7..bc5b599 100644 --- a/lib/gai_strerror.c +++ b/lib/gai_strerror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2017 Free Software +/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c index e0faec9..a0b638b 100644 --- a/lib/getaddrinfo.c +++ b/lib/getaddrinfo.c @@ -1,5 +1,5 @@ /* Get address information (partial implementation). - Copyright (C) 1997, 2001-2002, 2004-2017 Free Software Foundation, Inc. + Copyright (C) 1997, 2001-2002, 2004-2018 Free Software Foundation, Inc. Contributed by Simon Josefsson <simon@josefsson.org>. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc optimizes away the sa == NULL test below. */ @@ -54,7 +54,7 @@ # define PF_UNSPEC 0 #endif -#if defined _WIN32 || defined __WIN32__ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ # define WINDOWS_NATIVE #endif diff --git a/lib/getdelim.c b/lib/getdelim.c index e2e0885..09b362e 100644 --- a/lib/getdelim.c +++ b/lib/getdelim.c @@ -1,5 +1,5 @@ /* getdelim.c --- Implementation of replacement getdelim function. - Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2017 Free Software + Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Ported from glibc by Simon Josefsson. */ @@ -52,7 +52,7 @@ alloc_failed (void) { #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Avoid errno problem without using the realloc module; see: - http://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00025.html */ + https://lists.gnu.org/r/bug-gnulib/2016-08/msg00025.html */ errno = ENOMEM; #endif } diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c index 7fabb51..c6c1136 100644 --- a/lib/getdtablesize.c +++ b/lib/getdtablesize.c @@ -1,5 +1,5 @@ -/* getdtablesize() function for platforms that don't have it. - Copyright (C) 2008-2017 Free Software Foundation, Inc. +/* getdtablesize() function: Return maximum possible file descriptor value + 1. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -24,7 +24,9 @@ # include <stdio.h> -# include "msvc-inval.h" +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif # if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int @@ -44,7 +46,8 @@ _setmaxstdio_nothrow (int newmax) return result; } -# define _setmaxstdio _setmaxstdio_nothrow +# else +# define _setmaxstdio_nothrow _setmaxstdio # endif /* Cache for the previous getdtablesize () result. Safe to cache because @@ -76,9 +79,9 @@ getdtablesize (void) freed when we call _setmaxstdio with the original value. */ int orig_max_stdio = _getmaxstdio (); unsigned int bound; - for (bound = 0x10000; _setmaxstdio (bound) < 0; bound = bound / 2) + for (bound = 0x10000; _setmaxstdio_nothrow (bound) < 0; bound = bound / 2) ; - _setmaxstdio (orig_max_stdio); + _setmaxstdio_nothrow (orig_max_stdio); dtablesize = bound; } return dtablesize; diff --git a/lib/getgroups.c b/lib/getgroups.c index dce0f2d..ec137c1 100644 --- a/lib/getgroups.c +++ b/lib/getgroups.c @@ -1,6 +1,6 @@ /* provide consistent interface to getgroups for systems that don't allow N==0 - Copyright (C) 1996, 1999, 2003, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2003, 2006-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/getline.c b/lib/getline.c index 8b7c9f7..59397ea 100644 --- a/lib/getline.c +++ b/lib/getline.c @@ -1,5 +1,5 @@ /* getline.c --- Implementation of replacement getline function. - Copyright (C) 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson. */ diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h new file mode 100644 index 0000000..12b5a87 --- /dev/null +++ b/lib/getopt-cdefs.in.h @@ -0,0 +1,67 @@ +/* getopt-on-non-glibc compatibility macros. + Copyright (C) 1989-2018 Free Software Foundation, Inc. + This file is part of gnulib. + Unlike most of the getopt implementation, it is NOT shared + with the GNU C Library. + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3 of + the License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with gnulib; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _GETOPT_CDEFS_H +#define _GETOPT_CDEFS_H 1 + +/* This header should not be used directly; include getopt.h or + unistd.h instead. It does not have a protective #error, because + the guard macro for getopt.h in gnulib is not fixed. */ + +/* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect + a number of the internal macros supplied to GNU libc's headers by + sys/cdefs.h. Provide fallback definitions for all of them. */ +#if @HAVE_SYS_CDEFS_H@ +# include <sys/cdefs.h> +#endif + +#ifndef __BEGIN_DECLS +# ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# else +# define __BEGIN_DECLS /* nothing */ +# endif +#endif +#ifndef __END_DECLS +# ifdef __cplusplus +# define __END_DECLS } +# else +# define __END_DECLS /* nothing */ +# endif +#endif + +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_VERSION__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#ifndef __THROW +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif + +#endif /* _GETOPT_CDEFS_H */ diff --git a/lib/getopt-core.h b/lib/getopt-core.h new file mode 100644 index 0000000..e51b6c7 --- /dev/null +++ b/lib/getopt-core.h @@ -0,0 +1,96 @@ +/* Declarations for getopt (basic, portable features only). + Copyright (C) 1989-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library and is also part of gnulib. + Patches to this file should be submitted to both projects. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _GETOPT_CORE_H +#define _GETOPT_CORE_H 1 + +/* This header should not be used directly; include getopt.h or + unistd.h instead. Unlike most bits headers, it does not have + a protective #error, because the guard macro for getopt.h in + gnulib is not fixed. */ + +__BEGIN_DECLS + +/* For communication from 'getopt' to the caller. + When 'getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when 'ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to 'getopt'. + + On entry to 'getopt', zero means this is the first call; initialize. + + When 'getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, 'optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message 'getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, 'optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in 'optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU 'getopt'. + + The argument '--' causes premature termination of argument + scanning, explicitly telling 'getopt' that there are no more + options. + + If OPTS begins with '-', then non-option arguments are treated as + arguments to the option '\1'. This behavior is specific to the GNU + 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in + the environment, then do not permute arguments. + + For standards compliance, the 'argv' argument has the type + char *const *, but this is inaccurate; if argument permutation is + enabled, the argv array (not the strings it points to) must be + writable. */ + +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __THROW _GL_ARG_NONNULL ((2, 3)); + +__END_DECLS + +#endif /* _GETOPT_CORE_H */ diff --git a/lib/getopt-ext.h b/lib/getopt-ext.h new file mode 100644 index 0000000..cb41206 --- /dev/null +++ b/lib/getopt-ext.h @@ -0,0 +1,77 @@ +/* Declarations for getopt (GNU extensions). + Copyright (C) 1989-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library and is also part of gnulib. + Patches to this file should be submitted to both projects. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _GETOPT_EXT_H +#define _GETOPT_EXT_H 1 + +/* This header should not be used directly; include getopt.h instead. + Unlike most bits headers, it does not have a protective #error, + because the guard macro for getopt.h in gnulib is not fixed. */ + +__BEGIN_DECLS + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of 'struct option' terminated by an element containing a name which is + zero. + + The field 'has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field 'flag' is not NULL, it points to a variable that is set + to the value given in the field 'val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an 'int' to + a compiled-in constant, such as set a value from 'optarg', set the + option's 'flag' field to zero and its 'val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero 'flag' field, 'getopt' + returns the contents of the 'val' field. */ + +struct option +{ + const char *name; + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the 'has_arg' field of 'struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW _GL_ARG_NONNULL ((2, 3)); +extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW _GL_ARG_NONNULL ((2, 3)); + +__END_DECLS + +#endif /* _GETOPT_EXT_H */ diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h new file mode 100644 index 0000000..c62f9e2 --- /dev/null +++ b/lib/getopt-pfx-core.h @@ -0,0 +1,59 @@ +/* getopt (basic, portable features) gnulib wrapper header. + Copyright (C) 1989-2018 Free Software Foundation, Inc. + This file is part of gnulib. + Unlike most of the getopt implementation, it is NOT shared + with the GNU C Library. + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3 of + the License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with gnulib; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _GETOPT_PFX_CORE_H +#define _GETOPT_PFX_CORE_H 1 + +/* This header should not be used directly; include getopt.h or + unistd.h instead. It does not have a protective #error, because + the guard macro for getopt.h in gnulib is not fixed. */ + +/* Standalone applications should #define __GETOPT_PREFIX to an + identifier that prefixes the external functions and variables + defined in getopt-core.h and getopt-ext.h. Systematically + rename identifiers so that they do not collide with the system + functions and variables. Renaming avoids problems with some + compilers and linkers. */ +#ifdef __GETOPT_PREFIX +# ifndef __GETOPT_ID +# define __GETOPT_CONCAT(x, y) x ## y +# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) +# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) +# endif +# undef getopt +# undef optarg +# undef opterr +# undef optind +# undef optopt +# define getopt __GETOPT_ID (getopt) +# define optarg __GETOPT_ID (optarg) +# define opterr __GETOPT_ID (opterr) +# define optind __GETOPT_ID (optind) +# define optopt __GETOPT_ID (optopt) + +/* The system's getopt.h may have already included getopt-core.h to + declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that + getopt-core.h declares them with prefixes. */ +# undef _GETOPT_CORE_H +#endif + +#include <getopt-core.h> + +#endif /* _GETOPT_PFX_CORE_H */ diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h new file mode 100644 index 0000000..753f129 --- /dev/null +++ b/lib/getopt-pfx-ext.h @@ -0,0 +1,71 @@ +/* getopt (GNU extensions) gnulib wrapper header. + Copyright (C) 1989-2018 Free Software Foundation, Inc. + This file is part of gnulib. + Unlike most of the getopt implementation, it is NOT shared + with the GNU C Library. + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3 of + the License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with gnulib; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _GETOPT_PFX_EXT_H +#define _GETOPT_PFX_EXT_H 1 + +/* This header should not be used directly; include getopt.h instead. + It does not have a protective #error, because the guard macro for + getopt.h in gnulib is not fixed. */ + +/* Standalone applications should #define __GETOPT_PREFIX to an + identifier that prefixes the external functions and variables + defined in getopt-core.h and getopt-ext.h. Systematically + rename identifiers so that they do not collide with the system + functions and variables. Renaming avoids problems with some + compilers and linkers. */ +#ifdef __GETOPT_PREFIX +# ifndef __GETOPT_ID +# define __GETOPT_CONCAT(x, y) x ## y +# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) +# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) +# endif +# undef getopt_long +# undef getopt_long_only +# undef option +# undef _getopt_internal +# define getopt_long __GETOPT_ID (getopt_long) +# define getopt_long_only __GETOPT_ID (getopt_long_only) +# define option __GETOPT_ID (option) +# define _getopt_internal __GETOPT_ID (getopt_internal) + +/* The system's getopt.h may have already included getopt-ext.h to + declare the unprefixed identifiers. Undef _GETOPT_EXT_H so that + getopt-ext.h declares them with prefixes. */ +# undef _GETOPT_EXT_H +#endif + +/* Standalone applications get correct prototypes for getopt_long and + getopt_long_only; they declare "char **argv". For backward + compatibility with old applications, if __GETOPT_PREFIX is not + defined, we supply GNU-libc-compatible, but incorrect, prototypes + using "char *const *argv". (GNU libc is stuck with the incorrect + prototypes, as they are baked into older versions of LSB.) */ +#ifndef __getopt_argv_const +# if defined __GETOPT_PREFIX +# define __getopt_argv_const /* empty */ +# else +# define __getopt_argv_const const +# endif +#endif + +#include <getopt-ext.h> + +#endif /* _GETOPT_PFX_EXT_H */ diff --git a/lib/getopt.c b/lib/getopt.c index e40ea8d..55375cc 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -1,23 +1,21 @@ /* Getopt for GNU. - NOTE: getopt is part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2017 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, + Copyright (C) 1987-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library and is also part of gnulib. + Patches to this file should be submitted to both projects. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> @@ -31,30 +29,54 @@ #include <unistd.h> #ifdef _LIBC +/* When used as part of glibc, error printing must be done differently + for standards compliance. getopt is not a cancellation point, so + it must not call functions that are, and it is specified by an + older standard than stdio locking, so it must not refer to + functions in the "user namespace" related to stdio locking. + Finally, it must use glibc's internal message translation so that + the messages are looked up in the proper text domain. */ # include <libintl.h> +# define fprintf __fxprintf_nocancel +# define flockfile(fp) _IO_flockfile (fp) +# define funlockfile(fp) _IO_funlockfile (fp) #else # include "gettext.h" # define _(msgid) gettext (msgid) +/* When used standalone, flockfile and funlockfile might not be + available. */ +# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \ + || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) +# define flockfile(fp) /* nop */ +# define funlockfile(fp) /* nop */ +# endif +/* When used standalone, do not attempt to use alloca. */ +# define __libc_use_alloca(size) 0 +# undef alloca +# define alloca(size) (abort (), (void *)0) #endif -#if defined _LIBC && defined USE_IN_LIBIO -# include <wchar.h> -#endif - -/* This version of 'getopt' appears to the caller like standard Unix 'getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As 'getopt_long' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Using 'getopt' or setting the environment variable POSIXLY_CORRECT +/* This implementation of 'getopt' has three modes for handling + options interspersed with non-option arguments. It can stop + scanning for options at the first non-option argument encountered, + as POSIX specifies. It can continue scanning for options after the + first non-option argument, but permute 'argv' as it goes so that, + after 'getopt' is done, all the options precede all the non-option + arguments and 'optind' points to the first non-option argument. + Or, it can report non-option arguments as if they were arguments to + the option character '\x01'. + + The default behavior of 'getopt_long' is to permute the argument list. + When this implementation is used standalone, the default behavior of + 'getopt' is to stop at the first non-option argument, but when it is + used as part of GNU libc it also permutes the argument list. In both + cases, setting the environment variable POSIXLY_CORRECT to any value disables permutation. - Then the behavior is completely standard. - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ + If the first character of the OPTSTRING argument to 'getopt' or + 'getopt_long' is '+', both functions will stop at the first + non-option argument. If it is '-', both functions will report + non-option arguments as arguments to the option character '\x01'. */ #include "getopt_int.h" @@ -95,42 +117,7 @@ int optopt = '?'; /* Keep a global copy of all internal members of getopt_data. */ static struct _getopt_data getopt_data; - - -#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV -extern char *getenv (); -#endif -#ifdef _LIBC -/* Stored original parameters. - XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ -extern int __libc_argc; -extern char **__libc_argv; - -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -# ifdef USE_NONOPTION_FLAGS -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; -# endif - -# ifdef USE_NONOPTION_FLAGS -# define SWAP_FLAGS(ch1, ch2) \ - if (d->__nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -# else -# define SWAP_FLAGS(ch1, ch2) -# endif -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. @@ -153,64 +140,40 @@ exchange (char **argv, struct _getopt_data *d) It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ -#if defined _LIBC && defined USE_NONOPTION_FLAGS - /* First make sure the handling of the '__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - d->__nonoption_flags_max_len), - '\0', top + 1 - d->__nonoption_flags_max_len); - d->__nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - while (top > middle && middle > bottom) { if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } + { + /* Top segment is the short one. */ + int len = top - middle; + int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } } /* Update records for the slots the non-options now occupy. */ @@ -219,25 +182,216 @@ exchange (char **argv, struct _getopt_data *d) d->__last_nonopt = d->optind; } -/* Initialize the internal data when the first call is made. */ +/* Process the argument starting with d->__nextchar as a long option. + d->optind should *not* have been advanced over this argument. + + If the value returned is -1, it was not actually a long option, the + state is unchanged, and the argument should be processed as a set + of short options (this can only happen when long_only is true). + Otherwise, the option (and its argument, if any) have been consumed + and the return value is the value to return from _getopt_internal_r. */ +static int +process_long_option (int argc, char **argv, const char *optstring, + const struct option *longopts, int *longind, + int long_only, struct _getopt_data *d, + int print_errors, const char *prefix) +{ + char *nameend; + size_t namelen; + const struct option *p; + const struct option *pfound = NULL; + int n_options; + int option_index; + + for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + namelen = nameend - d->__nextchar; + + /* First look for an exact match, counting the options as a side + effect. */ + for (p = longopts, n_options = 0; p->name; p++, n_options++) + if (!strncmp (p->name, d->__nextchar, namelen) + && namelen == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + option_index = n_options; + break; + } + + if (pfound == NULL) + { + /* Didn't find an exact match, so look for abbreviations. */ + unsigned char *ambig_set = NULL; + int ambig_malloced = 0; + int ambig_fallback = 0; + int indfound = -1; + + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, d->__nextchar, namelen)) + { + if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else if (long_only + || pfound->has_arg != p->has_arg + || pfound->flag != p->flag + || pfound->val != p->val) + { + /* Second or later nonexact match found. */ + if (!ambig_fallback) + { + if (!print_errors) + /* Don't waste effort tracking the ambig set if + we're not going to print it anyway. */ + ambig_fallback = 1; + else if (!ambig_set) + { + if (__libc_use_alloca (n_options)) + ambig_set = alloca (n_options); + else if ((ambig_set = malloc (n_options)) == NULL) + /* Fall back to simpler error message. */ + ambig_fallback = 1; + else + ambig_malloced = 1; + + if (ambig_set) + { + memset (ambig_set, 0, n_options); + ambig_set[indfound] = 1; + } + } + if (ambig_set) + ambig_set[option_index] = 1; + } + } + } + + if (ambig_set || ambig_fallback) + { + if (print_errors) + { + if (ambig_fallback) + fprintf (stderr, _("%s: option '%s%s' is ambiguous\n"), + argv[0], prefix, d->__nextchar); + else + { + flockfile (stderr); + fprintf (stderr, + _("%s: option '%s%s' is ambiguous; possibilities:"), + argv[0], prefix, d->__nextchar); + + for (option_index = 0; option_index < n_options; option_index++) + if (ambig_set[option_index]) + fprintf (stderr, " '%s%s'", + prefix, longopts[option_index].name); + + /* This must use 'fprintf' even though it's only + printing a single character, so that it goes through + __fxprintf_nocancel when compiled as part of glibc. */ + fprintf (stderr, "\n"); + funlockfile (stderr); + } + } + if (ambig_malloced) + free (ambig_set); + d->__nextchar += strlen (d->__nextchar); + d->optind++; + d->optopt = 0; + return '?'; + } + + option_index = indfound; + } + + if (pfound == NULL) + { + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short option, + then it's an error. */ + if (!long_only || argv[d->optind][1] == '-' + || strchr (optstring, *d->__nextchar) == NULL) + { + if (print_errors) + fprintf (stderr, _("%s: unrecognized option '%s%s'\n"), + argv[0], prefix, d->__nextchar); + + d->__nextchar = NULL; + d->optind++; + d->optopt = 0; + return '?'; + } + + /* Otherwise interpret it as a short option. */ + return -1; + } + + /* We have found a matching long option. Consume it. */ + d->optind++; + d->__nextchar = NULL; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + d->optarg = nameend + 1; + else + { + if (print_errors) + fprintf (stderr, + _("%s: option '%s%s' doesn't allow an argument\n"), + argv[0], prefix, pfound->name); + + d->optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (d->optind < argc) + d->optarg = argv[d->optind++]; + else + { + if (print_errors) + fprintf (stderr, + _("%s: option '%s%s' requires an argument\n"), + argv[0], prefix, pfound->name); + + d->optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; +} + +/* Initialize internal data upon the first call to getopt. */ static const char * _getopt_initialize (int argc _GL_UNUSED, - char **argv _GL_UNUSED, const char *optstring, - struct _getopt_data *d, int posixly_correct) + char **argv _GL_UNUSED, const char *optstring, + struct _getopt_data *d, int posixly_correct) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ + if (d->optind == 0) + d->optind = 1; d->__first_nonopt = d->__last_nonopt = d->optind; - d->__nextchar = NULL; - d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); - /* Determine how to handle the ordering of options and nonoptions. */ - if (optstring[0] == '-') { d->__ordering = RETURN_IN_ORDER; @@ -248,41 +402,12 @@ _getopt_initialize (int argc _GL_UNUSED, d->__ordering = REQUIRE_ORDER; ++optstring; } - else if (d->__posixly_correct) + else if (posixly_correct || !!getenv ("POSIXLY_CORRECT")) d->__ordering = REQUIRE_ORDER; else d->__ordering = PERMUTE; -#if defined _LIBC && defined USE_NONOPTION_FLAGS - if (!d->__posixly_correct - && argc == __libc_argc && argv == __libc_argv) - { - if (d->__nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - d->__nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = d->__nonoption_flags_max_len = strlen (orig_str); - if (d->__nonoption_flags_max_len < argc) - d->__nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (d->__nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - d->__nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', d->__nonoption_flags_max_len - len); - } - } - d->__nonoption_flags_len = d->__nonoption_flags_max_len; - } - else - d->__nonoption_flags_len = 0; -#endif - + d->__initialized = 1; return optstring; } @@ -344,8 +469,8 @@ _getopt_initialize (int argc _GL_UNUSED, int _getopt_internal_r (int argc, char **argv, const char *optstring, - const struct option *longopts, int *longind, - int long_only, struct _getopt_data *d, int posixly_correct) + const struct option *longopts, int *longind, + int long_only, struct _getopt_data *d, int posixly_correct) { int print_errors = d->opterr; @@ -355,461 +480,129 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, d->optarg = NULL; if (d->optind == 0 || !d->__initialized) - { - if (d->optind == 0) - d->optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring, d, - posixly_correct); - d->__initialized = 1; - } + optstring = _getopt_initialize (argc, argv, optstring, d, posixly_correct); else if (optstring[0] == '-' || optstring[0] == '+') optstring++; + if (optstring[0] == ':') print_errors = 0; - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#if defined _LIBC && defined USE_NONOPTION_FLAGS -# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ - || (d->optind < d->__nonoption_flags_len \ - && __getopt_nonoption_flags[d->optind] == '1')) -#else -# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') -#endif + /* Test whether ARGV[optind] points to a non-option argument. */ +#define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') if (d->__nextchar == NULL || *d->__nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ + moved back by the user (who may also have changed the arguments). */ if (d->__last_nonopt > d->optind) - d->__last_nonopt = d->optind; + d->__last_nonopt = d->optind; if (d->__first_nonopt > d->optind) - d->__first_nonopt = d->optind; + d->__first_nonopt = d->optind; if (d->__ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ - if (d->__first_nonopt != d->__last_nonopt - && d->__last_nonopt != d->optind) - exchange ((char **) argv, d); - else if (d->__last_nonopt != d->optind) - d->__first_nonopt = d->optind; + if (d->__first_nonopt != d->__last_nonopt + && d->__last_nonopt != d->optind) + exchange (argv, d); + else if (d->__last_nonopt != d->optind) + d->__first_nonopt = d->optind; - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ - while (d->optind < argc && NONOPTION_P) - d->optind++; - d->__last_nonopt = d->optind; - } + while (d->optind < argc && NONOPTION_P) + d->optind++; + d->__last_nonopt = d->optind; + } /* The special ARGV-element '--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ if (d->optind != argc && !strcmp (argv[d->optind], "--")) - { - d->optind++; + { + d->optind++; - if (d->__first_nonopt != d->__last_nonopt - && d->__last_nonopt != d->optind) - exchange ((char **) argv, d); - else if (d->__first_nonopt == d->__last_nonopt) - d->__first_nonopt = d->optind; - d->__last_nonopt = argc; + if (d->__first_nonopt != d->__last_nonopt + && d->__last_nonopt != d->optind) + exchange (argv, d); + else if (d->__first_nonopt == d->__last_nonopt) + d->__first_nonopt = d->optind; + d->__last_nonopt = argc; - d->optind = argc; - } + d->optind = argc; + } /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ + and back over any non-options that we skipped and permuted. */ if (d->optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (d->__first_nonopt != d->__last_nonopt) - d->optind = d->__first_nonopt; - return -1; - } + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (d->__first_nonopt != d->__last_nonopt) + d->optind = d->__first_nonopt; + return -1; + } /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ + either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) - { - if (d->__ordering == REQUIRE_ORDER) - return -1; - d->optarg = argv[d->optind++]; - return 1; - } + { + if (d->__ordering == REQUIRE_ORDER) + return -1; + d->optarg = argv[d->optind++]; + return 1; + } /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - d->__nextchar = (argv[d->optind] + 1 - + (longopts != NULL && argv[d->optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[d->optind][1] == '-' - || (long_only && (argv[d->optind][2] - || !strchr (optstring, argv[d->optind][1]))))) - { - char *nameend; - unsigned int namelen; - const struct option *p; - const struct option *pfound = NULL; - struct option_list - { - const struct option *p; - struct option_list *next; - } *ambig_list = NULL; -#ifdef _LIBC -/* malloc() not used for _LIBC to simplify failure messages. */ -# define free_option_list(l) -#else -# define free_option_list(l) \ - while (l != NULL) \ - { \ - struct option_list *pn = l->next; \ - free (l); \ - l = pn; \ - } -#endif - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - namelen = nameend - d->__nextchar; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, d->__nextchar, namelen)) - { - if (namelen == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else if (ambig) - ; /* Taking simpler path to handling ambiguities. */ - else if (long_only - || pfound->has_arg != p->has_arg - || pfound->flag != p->flag - || pfound->val != p->val) - { - /* Second or later nonexact match found. */ -#ifdef _LIBC - struct option_list *newp = alloca (sizeof (*newp)); -#else - struct option_list *newp = malloc (sizeof (*newp)); - if (newp == NULL) - { - free_option_list (ambig_list); - ambig_list = NULL; - ambig = 1; /* Use simpler fallback message. */ - } - else -#endif - { - newp->p = p; - newp->next = ambig_list; - ambig_list = newp; - } - } - } - - if ((ambig || ambig_list) && !exact) - { - if (print_errors && ambig_list) - { - struct option_list first; - first.p = pfound; - first.next = ambig_list; - ambig_list = &first; - -#if defined _LIBC && defined USE_IN_LIBIO - char *buf = NULL; - size_t buflen = 0; - - FILE *fp = open_memstream (&buf, &buflen); - if (fp != NULL) - { - fprintf (fp, - _("%s: option '%s' is ambiguous; possibilities:"), - argv[0], argv[d->optind]); - - do - { - fprintf (fp, " '--%s'", ambig_list->p->name); - ambig_list = ambig_list->next; - } - while (ambig_list != NULL); - - fputc_unlocked ('\n', fp); - - if (__builtin_expect (fclose (fp) != EOF, 1)) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } - } -#else - fprintf (stderr, - _("%s: option '%s' is ambiguous; possibilities:"), - argv[0], argv[d->optind]); - do - { - fprintf (stderr, " '--%s'", ambig_list->p->name); - ambig_list = ambig_list->next; - } - while (ambig_list != NULL); - - fputc ('\n', stderr); -#endif - } - else if (print_errors && ambig) - { - fprintf (stderr, - _("%s: option '%s' is ambiguous\n"), - argv[0], argv[d->optind]); - } - d->__nextchar += strlen (d->__nextchar); - d->optind++; - d->optopt = 0; - free_option_list (ambig_list); - return '?'; - } - - free_option_list (ambig_list); - - if (pfound != NULL) - { - option_index = indfound; - d->optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - d->optarg = nameend + 1; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - int n; -#endif - - if (argv[d->optind - 1][1] == '-') - { - /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("\ -%s: option '--%s' doesn't allow an argument\n"), - argv[0], pfound->name); -#else - fprintf (stderr, _("\ -%s: option '--%s' doesn't allow an argument\n"), - argv[0], pfound->name); -#endif - } - else - { - /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("\ -%s: option '%c%s' doesn't allow an argument\n"), - argv[0], argv[d->optind - 1][0], - pfound->name); -#else - fprintf (stderr, _("\ -%s: option '%c%s' doesn't allow an argument\n"), - argv[0], argv[d->optind - 1][0], - pfound->name); -#endif - } - -#if defined _LIBC && defined USE_IN_LIBIO - if (n >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 - |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#endif - } - - d->__nextchar += strlen (d->__nextchar); - - d->optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (d->optind < argc) - d->optarg = argv[d->optind++]; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - if (__asprintf (&buf, _("\ -%s: option '--%s' requires an argument\n"), - argv[0], pfound->name) >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 - |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#else - fprintf (stderr, - _("%s: option '--%s' requires an argument\n"), - argv[0], pfound->name); -#endif - } - d->__nextchar += strlen (d->__nextchar); - d->optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - d->__nextchar += strlen (d->__nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[d->optind][1] == '-' - || strchr (optstring, *d->__nextchar) == NULL) - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - int n; -#endif - - if (argv[d->optind][1] == '-') - { - /* --option */ -#if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), - argv[0], d->__nextchar); -#else - fprintf (stderr, _("%s: unrecognized option '--%s'\n"), - argv[0], d->__nextchar); -#endif - } - else - { - /* +option or -option */ -#if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), - argv[0], argv[d->optind][0], d->__nextchar); -#else - fprintf (stderr, _("%s: unrecognized option '%c%s'\n"), - argv[0], argv[d->optind][0], d->__nextchar); -#endif - } - -#if defined _LIBC && defined USE_IN_LIBIO - if (n >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#endif - } - d->__nextchar = (char *) ""; - d->optind++; - d->optopt = 0; - return '?'; - } + Check whether it might be a long option. */ + if (longopts) + { + if (argv[d->optind][1] == '-') + { + /* "--foo" is always a long option. The special option + "--" was handled above. */ + d->__nextchar = argv[d->optind] + 2; + return process_long_option (argc, argv, optstring, longopts, + longind, long_only, d, + print_errors, "--"); + } + + /* If long_only and the ARGV-element has the form "-f", + where f is a valid short option, don't consider it an + abbreviated form of a long option that starts with f. + Otherwise there would be no way to give the -f short + option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an + abbreviation of the long option, just like "--fu", and + not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + if (long_only && (argv[d->optind][2] + || !strchr (optstring, argv[d->optind][1]))) + { + int code; + d->__nextchar = argv[d->optind] + 1; + code = process_long_option (argc, argv, optstring, longopts, + longind, long_only, d, + print_errors, "-"); + if (code != -1) + return code; + } + } + + /* It is not a long option. Skip the initial punctuation. */ + d->__nextchar = argv[d->optind] + 1; } /* Look at and handle the next short option-character. */ @@ -824,331 +617,83 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, if (temp == NULL || c == ':' || c == ';') { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - int n; -#endif - -#if defined _LIBC && defined USE_IN_LIBIO - n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), - argv[0], c); -#else - fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); -#endif - -#if defined _LIBC && defined USE_IN_LIBIO - if (n >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#endif - } - d->optopt = c; - return '?'; + if (print_errors) + fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); + d->optopt = c; + return '?'; } + /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') + if (temp[0] == 'W' && temp[1] == ';' && longopts != NULL) { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - if (longopts == NULL) - goto no_longs; - - /* This is an option that requires an argument. */ - if (*d->__nextchar != '\0') - { - d->optarg = d->__nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - d->optind++; - } - else if (d->optind == argc) - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - if (__asprintf (&buf, - _("%s: option requires an argument -- '%c'\n"), - argv[0], c) >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#else - fprintf (stderr, - _("%s: option requires an argument -- '%c'\n"), - argv[0], c); -#endif - } - d->optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented 'd->optind' once; - increment it again when taking next ARGV-elt as argument. */ - d->optarg = argv[d->optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; - nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) - { - if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else if (long_only - || pfound->has_arg != p->has_arg - || pfound->flag != p->flag - || pfound->val != p->val) - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), - argv[0], d->optarg) >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#else - fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"), - argv[0], d->optarg); -#endif - } - d->__nextchar += strlen (d->__nextchar); - d->optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - d->optarg = nameend + 1; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - if (__asprintf (&buf, _("\ -%s: option '-W %s' doesn't allow an argument\n"), - argv[0], pfound->name) >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 - |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#else - fprintf (stderr, _("\ -%s: option '-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); -#endif - } - - d->__nextchar += strlen (d->__nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (d->optind < argc) - d->optarg = argv[d->optind++]; - else - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - if (__asprintf (&buf, _("\ -%s: option '-W %s' requires an argument\n"), - argv[0], pfound->name) >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 - |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#else - fprintf (stderr, _("\ -%s: option '-W %s' requires an argument\n"), - argv[0], pfound->name); -#endif - } - d->__nextchar += strlen (d->__nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - else - d->optarg = NULL; - d->__nextchar += strlen (d->__nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - no_longs: - d->__nextchar = NULL; - return 'W'; /* Let the application handle it. */ + /* This is an option that requires an argument. */ + if (*d->__nextchar != '\0') + d->optarg = d->__nextchar; + else if (d->optind == argc) + { + if (print_errors) + fprintf (stderr, + _("%s: option requires an argument -- '%c'\n"), + argv[0], c); + + d->optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + d->optarg = argv[d->optind]; + + d->__nextchar = d->optarg; + d->optarg = NULL; + return process_long_option (argc, argv, optstring, longopts, longind, + 0 /* long_only */, d, print_errors, "-W "); } if (temp[1] == ':') { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*d->__nextchar != '\0') - { - d->optarg = d->__nextchar; - d->optind++; - } - else - d->optarg = NULL; - d->__nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*d->__nextchar != '\0') - { - d->optarg = d->__nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - d->optind++; - } - else if (d->optind == argc) - { - if (print_errors) - { -#if defined _LIBC && defined USE_IN_LIBIO - char *buf; - - if (__asprintf (&buf, _("\ -%s: option requires an argument -- '%c'\n"), - argv[0], c) >= 0) - { - _IO_flockfile (stderr); - - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; - - __fxprintf (NULL, "%s", buf); - - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); - - free (buf); - } -#else - fprintf (stderr, - _("%s: option requires an argument -- '%c'\n"), - argv[0], c); -#endif - } - d->optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented 'optind' once; - increment it again when taking next ARGV-elt as argument. */ - d->optarg = argv[d->optind++]; - d->__nextchar = NULL; - } + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*d->__nextchar != '\0') + { + d->optarg = d->__nextchar; + d->optind++; + } + else + d->optarg = NULL; + d->__nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*d->__nextchar != '\0') + { + d->optarg = d->__nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + d->optind++; + } + else if (d->optind == argc) + { + if (print_errors) + fprintf (stderr, + _("%s: option requires an argument -- '%c'\n"), + argv[0], c); + + d->optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented 'optind' once; + increment it again when taking next ARGV-elt as argument. */ + d->optarg = argv[d->optind++]; + d->__nextchar = NULL; + } } return c; } @@ -1156,8 +701,8 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, int _getopt_internal (int argc, char **argv, const char *optstring, - const struct option *longopts, int *longind, int long_only, - int posixly_correct) + const struct option *longopts, int *longind, int long_only, + int posixly_correct) { int result; @@ -1165,8 +710,8 @@ _getopt_internal (int argc, char **argv, const char *optstring, getopt_data.opterr = opterr; result = _getopt_internal_r (argc, argv, optstring, longopts, - longind, long_only, &getopt_data, - posixly_correct); + longind, long_only, &getopt_data, + posixly_correct); optind = getopt_data.optind; optarg = getopt_data.optarg; @@ -1175,32 +720,23 @@ _getopt_internal (int argc, char **argv, const char *optstring, return result; } -/* glibc gets a LSB-compliant getopt. - Standalone applications get a POSIX-compliant getopt. */ -#if _LIBC -enum { POSIXLY_CORRECT = 0 }; -#else -enum { POSIXLY_CORRECT = 1 }; -#endif - -int -getopt (int argc, char *const *argv, const char *optstring) -{ - return _getopt_internal (argc, (char **) argv, optstring, - (const struct option *) 0, - (int *) 0, - 0, POSIXLY_CORRECT); -} +/* glibc gets a LSB-compliant getopt and a POSIX-complaint __posix_getopt. + Standalone applications just get a POSIX-compliant getopt. + POSIX and LSB both require these functions to take 'char *const *argv' + even though this is incorrect (because of the permutation). */ +#define GETOPT_ENTRY(NAME, POSIXLY_CORRECT) \ + int \ + NAME (int argc, char *const *argv, const char *optstring) \ + { \ + return _getopt_internal (argc, (char **)argv, optstring, \ + 0, 0, 0, POSIXLY_CORRECT); \ + } #ifdef _LIBC -int -__posix_getopt (int argc, char *const *argv, const char *optstring) -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0, 1); -} +GETOPT_ENTRY(getopt, 0) +GETOPT_ENTRY(__posix_getopt, 1) +#else +GETOPT_ENTRY(getopt, 1) #endif @@ -1221,51 +757,51 @@ main (int argc, char **argv) c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) - break; + break; switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value '%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value '%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) - printf ("%s ", argv[optind++]); + printf ("%s ", argv[optind++]); printf ("\n"); } diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 6cbad8e..5fb58dd 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -1,20 +1,22 @@ /* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2017 Free Software - Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 1989-2018 Free Software Foundation, Inc. + This file is part of gnulib. + Unlike most of the getopt implementation, it is NOT shared + with the GNU C Library, which supplies a different version of + this file. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3 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 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + You should have received a copy of the GNU General Public + License along with gnulib; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_GETOPT_H @@ -32,230 +34,28 @@ # undef _GL_SYSTEM_GETOPT #endif -#ifndef _@GUARD_PREFIX@_GETOPT_H - -#ifndef __need_getopt -# define _@GUARD_PREFIX@_GETOPT_H 1 -#endif +#define _@GUARD_PREFIX@_GETOPT_H 1 /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables - defined in this header. When this happens, include the - headers that might declare getopt so that they will not cause - confusion if included after this file (if the system had <getopt.h>, - we have already included it). Then systematically rename - identifiers so that they do not collide with the system functions - and variables. Renaming avoids problems with some compilers and - linkers. */ + defined in getopt-core.h and getopt-ext.h. When this happens, + include the headers that might declare getopt so that they will not + cause confusion if included after this file (if the system had + <getopt.h>, we have already included it). */ #if defined __GETOPT_PREFIX -# if !defined __need_getopt -# if !@HAVE_GETOPT_H@ -# define __need_system_stdlib_h -# include <stdlib.h> -# undef __need_system_stdlib_h -# include <stdio.h> -# include <unistd.h> -# endif -# undef __need_getopt -# endif -# undef __GETOPT_CONCAT -# undef __GETOPT_XCONCAT -# undef __GETOPT_ID -# undef getopt -# undef getopt_long -# undef getopt_long_only -# undef optarg -# undef opterr -# undef optind -# undef optopt -# undef option -# undef _getopt_internal -# define __GETOPT_CONCAT(x, y) x ## y -# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) -# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) -# define getopt __GETOPT_ID (getopt) -# define getopt_long __GETOPT_ID (getopt_long) -# define getopt_long_only __GETOPT_ID (getopt_long_only) -# define optarg __GETOPT_ID (optarg) -# define opterr __GETOPT_ID (opterr) -# define optind __GETOPT_ID (optind) -# define optopt __GETOPT_ID (optopt) -# define option __GETOPT_ID (option) -# define _getopt_internal __GETOPT_ID (getopt_internal) -#endif - -/* Standalone applications get correct prototypes for getopt_long and - getopt_long_only; they declare "char **argv". libc uses prototypes - with "char *const *argv" that are incorrect because getopt_long and - getopt_long_only can permute argv; this is required for backward - compatibility (e.g., for LSB 2.0.1). - - This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt', - but it caused redefinition warnings if both unistd.h and getopt.h were - included, since unistd.h includes getopt.h having previously defined - __need_getopt. - - The only place where __getopt_argv_const is used is in definitions - of getopt_long and getopt_long_only below, but these are visible - only if __need_getopt is not defined, so it is quite safe to rewrite - the conditional as follows: -*/ -#if !defined __need_getopt -# if defined __GETOPT_PREFIX -# define __getopt_argv_const /* empty */ -# else -# define __getopt_argv_const const -# endif -#endif - -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include <features.h>, but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include <ctype.h>, which will pull in <features.h> for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ -# include <ctype.h> -#endif - -#ifndef __THROW -# ifndef __GNUC_PREREQ -# define __GNUC_PREREQ(maj, min) (0) -# endif -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW +# if !@HAVE_GETOPT_H@ +# define __need_system_stdlib_h +# include <stdlib.h> +# undef __need_system_stdlib_h +# include <stdio.h> +# include <unistd.h> # endif #endif /* The definition of _GL_ARG_NONNULL is copied here. */ -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from 'getopt' to the caller. - When 'getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when 'ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to 'getopt'. - - On entry to 'getopt', zero means this is the first call; initialize. - - When 'getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, 'optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message 'getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ +#include <getopt-cdefs.h> +#include <getopt-pfx-core.h> +#include <getopt-pfx-ext.h> -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of 'struct option' terminated by an element containing a name which is - zero. - - The field 'has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field 'flag' is not NULL, it points to a variable that is set - to the value given in the field 'val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an 'int' to - a compiled-in constant, such as set a value from 'optarg', set the - option's 'flag' field to zero and its 'val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero 'flag' field, 'getopt' - returns the contents of the 'val' field. */ - -# if !GNULIB_defined_struct_option -struct option -{ - const char *name; - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; -# define GNULIB_defined_struct_option 1 -# endif - -/* Names for the values of the 'has_arg' field of 'struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, 'optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in 'optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU 'getopt'. - - The argument '--' causes premature termination of argument - scanning, explicitly telling 'getopt' that there are no more - options. - - If OPTS begins with '-', then non-option arguments are treated as - arguments to the option '\1'. This behavior is specific to the GNU - 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in - the environment, then do not permute arguments. */ - -extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) - __THROW _GL_ARG_NONNULL ((2, 3)); - -#ifndef __need_getopt -extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind) - __THROW _GL_ARG_NONNULL ((2, 3)); -extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind) - __THROW _GL_ARG_NONNULL ((2, 3)); - -#endif - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* _@GUARD_PREFIX@_GETOPT_H */ #endif /* _@GUARD_PREFIX@_GETOPT_H */ diff --git a/lib/getopt1.c b/lib/getopt1.c index 4d2e8cb..9c7fff4 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -1,56 +1,44 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2017 Free Software - Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 1987-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library and is also part of gnulib. + Patches to this file should be submitted to both projects. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ -#ifdef _LIBC -# include <getopt.h> -#else +#ifndef _LIBC # include <config.h> -# include "getopt.h" #endif -#include "getopt_int.h" - -#include <stdio.h> -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include <stdlib.h> -#endif - -#ifndef NULL -#define NULL 0 -#endif +#include "getopt.h" +#include "getopt_int.h" int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, - const struct option *long_options, int *opt_index) + const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, - opt_index, 0, 0); + opt_index, 0, 0); } int _getopt_long_r (int argc, char **argv, const char *options, - const struct option *long_options, int *opt_index, - struct _getopt_data *d) + const struct option *long_options, int *opt_index, + struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, - 0, d, 0); + 0, d, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. @@ -60,26 +48,27 @@ _getopt_long_r (int argc, char **argv, const char *options, int getopt_long_only (int argc, char *__getopt_argv_const *argv, - const char *options, - const struct option *long_options, int *opt_index) + const char *options, + const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, - opt_index, 1, 0); + opt_index, 1, 0); } int _getopt_long_only_r (int argc, char **argv, const char *options, - const struct option *long_options, int *opt_index, - struct _getopt_data *d) + const struct option *long_options, int *opt_index, + struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, - 1, d, 0); + 1, d, 0); } #ifdef TEST #include <stdio.h> +#include <stdlib.h> int main (int argc, char **argv) @@ -93,74 +82,74 @@ main (int argc, char **argv) int option_index = 0; static const struct option long_options[] = { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); + long_options, &option_index); if (c == -1) - break; + break; switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value '%s'\n", optarg); - break; - - case 'd': - printf ("option d with value '%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value '%s'\n", optarg); + break; + + case 'd': + printf ("option d with value '%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) - printf ("%s ", argv[optind++]); + printf ("%s ", argv[optind++]); printf ("\n"); } diff --git a/lib/getopt_int.h b/lib/getopt_int.h index a7ce0e9..b0e9a6d 100644 --- a/lib/getopt_int.h +++ b/lib/getopt_int.h @@ -1,30 +1,31 @@ /* Internal declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2017 Free Software - Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 1989-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library and is also part of gnulib. + Patches to this file should be submitted to both projects. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ #ifndef _GETOPT_INT_H -#define _GETOPT_INT_H 1 +#define _GETOPT_INT_H 1 #include <getopt.h> extern int _getopt_internal (int ___argc, char **___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only, int __posixly_correct); + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument @@ -32,28 +33,20 @@ extern int _getopt_internal (int ___argc, char **___argv, /* Describe how to deal with options that follow non-option ARGV-elements. - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. + REQUIRE_ORDER means don't recognize them as options; stop option + processing when the first non-option is seen. This is what POSIX + specifies should happen. - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using '+' as the first character - of the list of option characters, or by calling getopt. - - PERMUTE is the default. We permute the contents of ARGV as we - scan, so that eventually all the non-options are at the end. - This allows options to be given in any order, even with programs - that were not written to expect this. + PERMUTE means permute the contents of ARGV as we scan, so that + eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written + to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option - with character code 1. Using '-' as the first character of the - list of option characters selects this mode of operation. + with character code 1. The special argument '--' forces an end of option-scanning regardless of the value of 'ordering'. In the case of RETURN_IN_ORDER, only @@ -91,11 +84,6 @@ struct _getopt_data /* See __ord above. */ enum __ord __ordering; - /* If the POSIXLY_CORRECT environment variable is set - or getopt was called. */ - int __posixly_correct; - - /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have @@ -104,32 +92,27 @@ struct _getopt_data int __first_nonopt; int __last_nonopt; - -#if defined _LIBC && defined USE_NONOPTION_FLAGS - int __nonoption_flags_max_len; - int __nonoption_flags_len; -#endif }; /* The initializer is necessary to set OPTIND and OPTERR to their default values and to clear the initialization flag. */ -#define _GETOPT_DATA_INITIALIZER { 1, 1 } +#define _GETOPT_DATA_INITIALIZER { 1, 1 } extern int _getopt_internal_r (int ___argc, char **___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only, struct _getopt_data *__data, - int __posixly_correct); + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only, struct _getopt_data *__data, + int __posixly_correct); extern int _getopt_long_r (int ___argc, char **___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - struct _getopt_data *__data); + const char *__shortopts, + const struct option *__longopts, int *__longind, + struct _getopt_data *__data); extern int _getopt_long_only_r (int ___argc, char **___argv, - const char *__shortopts, - const struct option *__longopts, - int *__longind, - struct _getopt_data *__data); + const char *__shortopts, + const struct option *__longopts, + int *__longind, + struct _getopt_data *__data); #endif /* getopt_int.h */ diff --git a/lib/getpass.c b/lib/getpass.c index 6ae7de5..786fdf2 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2001, 2003-2007, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 1992-2001, 2003-2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/getpass.h b/lib/getpass.h index 71d41e6..7e31aea 100644 --- a/lib/getpass.h +++ b/lib/getpass.h @@ -1,5 +1,5 @@ /* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin. - Copyright (C) 2004, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2018 Free Software Foundation, Inc. Contributed by Simon Josefsson <jas@extundo.com>, 2004. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef GETPASS_H # define GETPASS_H diff --git a/lib/getpeername.c b/lib/getpeername.c index a59a98c..6f3eceb 100644 --- a/lib/getpeername.c +++ b/lib/getpeername.c @@ -1,6 +1,6 @@ /* getpeername.c --- wrappers for Windows getpeername function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/getprogname.c b/lib/getprogname.c index 5295484..c824b47 100644 --- a/lib/getprogname.c +++ b/lib/getprogname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016-2017 Free Software Foundation, Inc. + Copyright (C) 2016-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -64,7 +64,7 @@ getprogname (void) /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ return last_component (program_invocation_name); # elif HAVE_GETEXECNAME /* Solaris */ - /* http://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ + /* https://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ const char *p = getexecname (); if (!p) p = "?"; @@ -74,7 +74,7 @@ getprogname (void) const char *p = __argv && __argv[0] ? __argv[0] : "?"; return last_component (p); # elif HAVE_VAR___PROGNAME /* OpenBSD, QNX */ - /* http://man.openbsd.org/style.9 */ + /* https://man.openbsd.org/style.9 */ /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */ /* Be careful to declare this only when we absolutely need it (OpenBSD 5.1), rather than when it's available. Otherwise, @@ -85,9 +85,8 @@ getprogname (void) return p && p[0] ? p : "?"; # elif _AIX /* AIX */ /* Idea by Bastien ROUCARIÈS, - http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00095.html - Reference: http:// - ibm.biz/knowctr#ssw_aix_53/com.ibm.aix.basetechref/doc/basetrf1/getprocs.htm + https://lists.gnu.org/r/bug-gnulib/2010-12/msg00095.html + Reference: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_61/com.ibm.aix.basetrf1/getprocs.htm */ static char *p; static int first = 1; @@ -165,7 +164,7 @@ getprogname (void) if (ioctl_ok) { char *name = buf.pr_fname; - char *namesize = sizeof buf.pr_fname; + size_t namesize = sizeof buf.pr_fname; char *namenul = memchr (name, '\0', namesize); size_t namelen = namenul ? namenul - name : namesize; char *namecopy = malloc (namelen + 1); @@ -183,3 +182,10 @@ getprogname (void) } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/getprogname.h b/lib/getprogname.h index 9ab924c..ee6688f 100644 --- a/lib/getprogname.h +++ b/lib/getprogname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016-2017 Free Software Foundation, Inc. + Copyright (C) 2016-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_GETPROGNAME_H #define _GL_GETPROGNAME_H diff --git a/lib/getsockname.c b/lib/getsockname.c index 32220d4..fc8f6f5 100644 --- a/lib/getsockname.c +++ b/lib/getsockname.c @@ -1,6 +1,6 @@ /* getsockname.c --- wrappers for Windows getsockname function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/gettext.h b/lib/gettext.h index 0465d7a..f2d7458 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2017 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,13 +13,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS +/* NLS can be disabled through the configure --disable-nls option + or through "#define ENABLE NLS 0" before including this file. */ +#if defined ENABLE_NLS && ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include <libintl.h> @@ -184,7 +185,8 @@ npgettext_aux (const char *domain, #include <string.h> #if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ - /* || __STDC_VERSION__ >= 199901L */ ) + /* || __STDC_VERSION__ == 199901L + || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ) # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 #else # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 diff --git a/lib/gettime.c b/lib/gettime.c index 4ae313e..9a4e342 100644 --- a/lib/gettime.c +++ b/lib/gettime.c @@ -1,6 +1,6 @@ /* gettime -- get the system clock - Copyright (C) 2002, 2004-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2004-2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index 18dcbda..3957565 100644 --- a/lib/gettimeofday.c +++ b/lib/gettimeofday.c @@ -1,6 +1,6 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ @@ -24,93 +24,95 @@ #include <time.h> -#if HAVE_SYS_TIMEB_H -# include <sys/timeb.h> +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# define WINDOWS_NATIVE +# include <windows.h> #endif -#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME +#include "localtime-buffer.h" -/* Work around the bug in some systems whereby gettimeofday clobbers - the static buffer that localtime uses for its return value. The - gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has - this problem. The tzset replacement is necessary for at least - Solaris 2.5, 2.5.1, and 2.6. */ - -static struct tm tm_zero_buffer; -static struct tm *localtime_buffer_addr = &tm_zero_buffer; - -# undef localtime -extern struct tm *localtime (time_t const *); - -# undef gmtime -extern struct tm *gmtime (time_t const *); - -/* This is a wrapper for localtime. It is used only on systems for which - gettimeofday clobbers the static buffer used for localtime's result. +#ifdef WINDOWS_NATIVE - On the first call, record the address of the static buffer that - localtime uses for its result. */ - -struct tm * -rpl_localtime (time_t const *timep) -{ - struct tm *tm = localtime (timep); - - if (localtime_buffer_addr == &tm_zero_buffer) - localtime_buffer_addr = tm; - - return tm; -} +/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */ +typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime); +static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL; +static BOOL initialized = FALSE; -/* Same as above, since gmtime and localtime use the same buffer. */ -struct tm * -rpl_gmtime (time_t const *timep) +static void +initialize (void) { - struct tm *tm = gmtime (timep); - - if (localtime_buffer_addr == &tm_zero_buffer) - localtime_buffer_addr = tm; - - return tm; + HMODULE kernel32 = LoadLibrary ("kernel32.dll"); + if (kernel32 != NULL) + { + GetSystemTimePreciseAsFileTimeFunc = + (GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime"); + } + initialized = TRUE; } -#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */ - -#if TZSET_CLOBBERS_LOCALTIME - -# undef tzset -extern void tzset (void); - -/* This is a wrapper for tzset, for systems on which tzset may clobber - the static buffer used for localtime's result. */ -void -rpl_tzset (void) -{ - /* Save and restore the contents of the buffer used for localtime's - result around the call to tzset. */ - struct tm save = *localtime_buffer_addr; - tzset (); - *localtime_buffer_addr = save; -} #endif /* This is a wrapper for gettimeofday. It is used only on systems that lack this function, or whose implementation of this function - causes problems. */ + causes problems. + Work around the bug in some systems whereby gettimeofday clobbers + the static buffer that localtime uses for its return value. The + gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has + this problem. */ int gettimeofday (struct timeval *restrict tv, void *restrict tz) { #undef gettimeofday -#if HAVE_GETTIMEOFDAY -# if GETTIMEOFDAY_CLOBBERS_LOCALTIME +#ifdef WINDOWS_NATIVE + + /* On native Windows, there are two ways to get the current time: + GetSystemTimeAsFileTime + <https://msdn.microsoft.com/en-us/library/ms724397.aspx> + or + GetSystemTimePreciseAsFileTime + <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. + GetSystemTimeAsFileTime produces values that jump by increments of + 15.627 milliseconds (!) on average. + Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2 + microseconds. + More discussion on this topic: + <http://www.windowstimestamp.com/description>. */ + FILETIME current_time; + + if (!initialized) + initialize (); + if (GetSystemTimePreciseAsFileTimeFunc != NULL) + GetSystemTimePreciseAsFileTimeFunc (¤t_time); + else + GetSystemTimeAsFileTime (¤t_time); + + /* Convert from FILETIME to 'struct timeval'. */ + /* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ + ULONGLONG since_1601 = + ((ULONGLONG) current_time.dwHighDateTime << 32) + | (ULONGLONG) current_time.dwLowDateTime; + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap + years, in total 134774 days. */ + ULONGLONG since_1970 = + since_1601 - (ULONGLONG) 134774 * (ULONGLONG) 86400 * (ULONGLONG) 10000000; + ULONGLONG microseconds_since_1970 = since_1970 / (ULONGLONG) 10; + tv->tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000; + tv->tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000; + + return 0; + +#else + +# if HAVE_GETTIMEOFDAY +# if GETTIMEOFDAY_CLOBBERS_LOCALTIME /* Save and restore the contents of the buffer used for localtime's result around the call to gettimeofday. */ struct tm save = *localtime_buffer_addr; -# endif +# endif -# if defined timeval /* 'struct timeval' overridden by gnulib? */ -# undef timeval +# if defined timeval /* 'struct timeval' overridden by gnulib? */ +# undef timeval struct timeval otv; int result = gettimeofday (&otv, (struct timezone *) tz); if (result == 0) @@ -118,25 +120,16 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) tv->tv_sec = otv.tv_sec; tv->tv_usec = otv.tv_usec; } -# else +# else int result = gettimeofday (tv, (struct timezone *) tz); -# endif +# endif -# if GETTIMEOFDAY_CLOBBERS_LOCALTIME +# if GETTIMEOFDAY_CLOBBERS_LOCALTIME *localtime_buffer_addr = save; -# endif +# endif return result; -#else - -# if HAVE__FTIME - - struct _timeb timebuf; - _ftime (&timebuf); - tv->tv_sec = timebuf.time; - tv->tv_usec = timebuf.millitm * 1000; - # else # if !defined OK_TO_USE_1S_CLOCK @@ -146,9 +139,8 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) tv->tv_sec = time (NULL); tv->tv_usec = 0; -# endif - return 0; +# endif #endif } diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h index ccf1fdf..7ac3857 100644 --- a/lib/gl_openssl.h +++ b/lib/gl_openssl.h @@ -1,6 +1,6 @@ /* Wrap openssl crypto hash routines in gnulib interface. -*- coding: utf-8 -*- - Copyright (C) 2013-2017 Free Software Foundation, Inc. + Copyright (C) 2013-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Pádraig Brady */ diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c index ca44c23..f166d7c 100644 --- a/lib/glthread/lock.c +++ b/lib/glthread/lock.c @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, @@ -30,7 +30,7 @@ /* ------------------------- gl_rwlock_t datatype ------------------------- */ -# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (__GNU_LIBRARY__ > 1)) +# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) # ifdef PTHREAD_RWLOCK_INITIALIZER diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h index ea7a5b5..34ff109 100644 --- a/lib/glthread/lock.h +++ b/lib/glthread/lock.h @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, @@ -140,7 +140,9 @@ extern int glthread_in_use (void); # pragma weak pthread_mutexattr_settype # pragma weak pthread_mutexattr_destroy # pragma weak pthread_rwlockattr_init -# pragma weak pthread_rwlockattr_setkind_np +# if __GNU_LIBRARY__ > 1 +# pragma weak pthread_rwlockattr_setkind_np +# endif # pragma weak pthread_rwlockattr_destroy # ifndef pthread_self # pragma weak pthread_self @@ -179,7 +181,7 @@ typedef pthread_mutex_t gl_lock_t; /* ------------------------- gl_rwlock_t datatype ------------------------- */ -# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (__GNU_LIBRARY__ > 1)) +# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) # ifdef PTHREAD_RWLOCK_INITIALIZER diff --git a/lib/glthread/threadlib.c b/lib/glthread/threadlib.c index bf2e19c..e8b484a 100644 --- a/lib/glthread/threadlib.c +++ b/lib/glthread/threadlib.c @@ -1,5 +1,5 @@ /* Multithreading primitives. - Copyright (C) 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ diff --git a/lib/group-member.c b/lib/group-member.c index 20f8ee8..3747dfe 100644 --- a/lib/group-member.c +++ b/lib/group-member.c @@ -1,6 +1,6 @@ /* group-member.c -- determine whether group id is in calling user's group list - Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2017 Free Software + Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/hard-locale.c b/lib/hard-locale.c index 57ed42b..49bc6ca 100644 --- a/lib/hard-locale.c +++ b/lib/hard-locale.c @@ -1,6 +1,6 @@ /* hard-locale.c -- Determine whether a locale is hard. - Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2017 Free Software + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/hard-locale.h b/lib/hard-locale.h index ba424af..22eecc5 100644 --- a/lib/hard-locale.h +++ b/lib/hard-locale.h @@ -1,6 +1,6 @@ /* Determine whether a locale is hard. - Copyright (C) 1999, 2003-2004, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1999, 2003-2004, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef HARD_LOCALE_H_ # define HARD_LOCALE_H_ 1 diff --git a/lib/iconv.in.h b/lib/iconv.in.h index ddaae67..fa8ca1b 100644 --- a/lib/iconv.in.h +++ b/lib/iconv.in.h @@ -1,6 +1,6 @@ /* A GNU-like <iconv.h>. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_ICONV_H diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index e5bb9db..4ef8fd4 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -1,6 +1,6 @@ /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form - Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* * Copyright (c) 1996-1999 by Internet Software Consortium. diff --git a/lib/intprops.h b/lib/intprops.h index 85ed61f..15e470c 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -1,6 +1,6 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -21,13 +21,12 @@ #define _GL_INTPROPS_H #include <limits.h> -#include <verify.h> /* Return a value with the common real type of E and V and the value of V. */ #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see - <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */ #define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) /* The extra casts in the following macros work around compiler bugs, @@ -80,24 +79,7 @@ /* This include file assumes that signed types are two's complement without padding bits; the above macros have undefined behavior otherwise. If this is a problem for you, please let us know how to fix it for your host. - As a sanity check, test the assumption for some signed types that - <limits.h> bounds. */ -verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); -verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); -verify (TYPE_MINIMUM (short int) == SHRT_MIN); -verify (TYPE_MAXIMUM (short int) == SHRT_MAX); -verify (TYPE_MINIMUM (int) == INT_MIN); -verify (TYPE_MAXIMUM (int) == INT_MAX); -verify (TYPE_MINIMUM (long int) == LONG_MIN); -verify (TYPE_MAXIMUM (long int) == LONG_MAX); -#ifdef LLONG_MAX -verify (TYPE_MINIMUM (long long int) == LLONG_MIN); -verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); -#endif -/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ -#ifdef UINT_WIDTH -verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); -#endif + This assumption is tested by the intprops-tests module. */ /* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ @@ -197,7 +179,7 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); /* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. See above for restrictions. Avoid && and || as they tickle bugs in Sun C 5.11 2010/08/13 and other compilers; see - <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>. */ #define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ ((b) < 0 \ ? ((a) < 0 \ @@ -237,7 +219,11 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); : (max) >> (b) < (a)) /* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ -#define _GL_HAS_BUILTIN_OVERFLOW (5 <= __GNUC__) +#if 5 <= __GNUC__ && !defined __ICC +# define _GL_HAS_BUILTIN_OVERFLOW 1 +#else +# define _GL_HAS_BUILTIN_OVERFLOW 0 +#endif /* True if __builtin_add_overflow_p (A, B, C) works. */ #define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) @@ -389,10 +375,10 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); (_Generic \ (*(r), \ signed char: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ signed char, SCHAR_MIN, SCHAR_MAX), \ short int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ short int, SHRT_MIN, SHRT_MAX), \ int: \ _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ @@ -406,10 +392,10 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); #else # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ (sizeof *(r) == sizeof (signed char) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ signed char, SCHAR_MIN, SCHAR_MAX) \ : sizeof *(r) == sizeof (short int) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ short int, SHRT_MIN, SHRT_MAX) \ : sizeof *(r) == sizeof (int) \ ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ @@ -431,9 +417,8 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); /* Store the low-order bits of A <op> B into *R, where the operation is given by OP. Use the unsigned type UT for calculation to avoid - overflow problems. *R's type is T, with extremal values TMIN and - TMAX. T must be a signed integer type. Return 1 if the result - overflows. */ + overflow problems. *R's type is T, with extrema TMIN and TMAX. + T must be a signed integer type. Return 1 if the result overflows. */ #define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ (sizeof ((a) op (b)) < sizeof (t) \ ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \ @@ -442,17 +427,27 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); ((overflow (a, b) \ || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \ || (tmax) < ((a) op (b))) \ - ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \ - : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0)) - -/* Return A <op> B, where the operation is given by OP. Use the - unsigned type UT for calculation to avoid overflow problems. - Convert the result to type T without overflow by subtracting TMIN - from large values before converting, and adding it afterwards. - Compilers can optimize all the operations except OP. */ -#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \ - (((ut) (a) op (ut) (b)) <= (tmax) \ - ? (t) ((ut) (a) op (ut) (b)) \ - : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin))) + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0)) + +/* Return the low-order bits of A <op> B, where the operation is given + by OP. Use the unsigned type UT for calculation to avoid undefined + behavior on signed integer overflow, and convert the result to type T. + UT is at least as wide as T and is no narrower than unsigned int, + T is two's complement, and there is no padding or trap representations. + Assume that converting UT to T yields the low-order bits, as is + done in all known two's-complement C compilers. E.g., see: + https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html + + According to the C standard, converting UT to T yields an + implementation-defined result or signal for values outside T's + range. However, code that works around this theoretical problem + runs afoul of a compiler bug in Oracle Studio 12.3 x86. See: + https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html + As the compiler bug is real, don't try to work around the + theoretical problem. */ + +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \ + ((t) ((ut) (a) op (ut) (b))) #endif /* _GL_INTPROPS_H */ diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 69b12a8..ca3cec5 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2017 Free Software Foundation, Inc. +/* Copyright (C) 2006-2018 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Derek Price. This file is part of gnulib. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* * ISO C 99 <inttypes.h> for platforms that lack it. diff --git a/lib/ioctl.c b/lib/ioctl.c index a28a3ae..140c7b6 100644 --- a/lib/ioctl.c +++ b/lib/ioctl.c @@ -1,6 +1,6 @@ /* ioctl.c --- wrappers for Windows ioctl function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ @@ -52,7 +52,11 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */) # include "fd-hook.h" /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif static int primary_ioctl (int fd, int request, void *arg) diff --git a/lib/iswblank.c b/lib/iswblank.c index 14f4595..bdd86cb 100644 --- a/lib/iswblank.c +++ b/lib/iswblank.c @@ -1,5 +1,5 @@ /* Test wide character for being blank. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/itold.c b/lib/itold.c index 9eb9507..6a43bd8 100644 --- a/lib/itold.c +++ b/lib/itold.c @@ -1,5 +1,5 @@ /* Replacement for 'int' to 'long double' conversion routine. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h index 7981cbf..a2f95a9 100644 --- a/lib/langinfo.in.h +++ b/lib/langinfo.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <langinfo.h>. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* * POSIX <langinfo.h> for platforms that lack it or have an incomplete one. diff --git a/lib/limits.in.h b/lib/limits.in.h index a7e307f..2c809d9 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -1,6 +1,6 @@ /* A GNU-like <limits.h>. - Copyright 2016-2017 Free Software Foundation, Inc. + Copyright 2016-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_LIMITS_H @@ -28,6 +28,17 @@ #ifndef _@GUARD_PREFIX@_LIMITS_H #define _@GUARD_PREFIX@_LIMITS_H +/* For HP-UX 11.31. */ +#if defined LONG_LONG_MIN && !defined LLONG_MIN +# define LLONG_MIN LONG_LONG_MIN +#endif +#if defined LONG_LONG_MAX && !defined LLONG_MAX +# define LLONG_MAX LONG_LONG_MAX +#endif +#if defined ULONG_LONG_MAX && !defined ULLONG_MAX +# define ULLONG_MAX ULONG_LONG_MAX +#endif + /* The number of usable bits in an unsigned or signed integer type with minimum value MIN and maximum value MAX, as an int expression suitable in #if. Cover all known practical hosts. This @@ -1,6 +1,6 @@ /* Emulate link on platforms that lack it, namely native Windows platforms. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/listen.c b/lib/listen.c index 81936f0..00627f6 100644 --- a/lib/listen.c +++ b/lib/listen.c @@ -1,6 +1,6 @@ /* listen.c --- wrappers for Windows listen function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/localcharset.c b/lib/localcharset.c index 9d0a1b8..d583d6b 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ @@ -32,7 +32,7 @@ # define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */ #endif -#if defined _WIN32 || defined __WIN32__ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ # define WINDOWS_NATIVE # include <locale.h> #endif @@ -75,6 +75,7 @@ # include "relocatable.h" #else # define relocate(pathname) (pathname) +# define relocate2(pathname,allocatedp) (*(allocatedp) = NULL, (pathname)) #endif /* Get LIBDIR. */ @@ -129,6 +130,7 @@ get_charset_aliases (void) if (cp == NULL) { #if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2) + char *malloc_dir = NULL; const char *dir; const char *base = "charset.alias"; char *file_name; @@ -137,7 +139,7 @@ get_charset_aliases (void) necessary for running the testsuite before "make install". */ dir = getenv ("CHARSETALIASDIR"); if (dir == NULL || dir[0] == '\0') - dir = relocate (LIBDIR); + dir = relocate2 (LIBDIR, &malloc_dir); /* Concatenate dir and base into freshly allocated file_name. */ { @@ -154,6 +156,8 @@ get_charset_aliases (void) } } + free (malloc_dir); + if (file_name == NULL) /* Out of memory. Treat the file as empty. */ cp = ""; @@ -351,7 +355,7 @@ get_charset_aliases (void) by Alex Taylor: <http://altsan.org/os2/toolkits/uls/index.html#codepages>. See also "IBM Globalization - Code page identifiers": - <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */ + <https://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */ cp = "CP813" "\0" "ISO-8859-7" "\0" "CP878" "\0" "KOI8-R" "\0" "CP819" "\0" "ISO-8859-1" "\0" diff --git a/lib/localcharset.h b/lib/localcharset.h index a2e2a7b..3ce8b94 100644 --- a/lib/localcharset.h +++ b/lib/localcharset.h @@ -1,5 +1,5 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LOCALCHARSET_H #define _LOCALCHARSET_H diff --git a/lib/locale.in.h b/lib/locale.in.h index 9eb43f9..1b27f1f 100644 --- a/lib/locale.in.h +++ b/lib/locale.in.h @@ -1,5 +1,5 @@ /* A POSIX <locale.h>. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/localeconv.c b/lib/localeconv.c index bc1960b..87cface 100644 --- a/lib/localeconv.c +++ b/lib/localeconv.c @@ -1,5 +1,5 @@ /* Query locale dependent information for formatting numbers. - Copyright (C) 2012-2017 Free Software Foundation, Inc. + Copyright (C) 2012-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/localtime-buffer.c b/lib/localtime-buffer.c new file mode 100644 index 0000000..df11f43 --- /dev/null +++ b/lib/localtime-buffer.c @@ -0,0 +1,58 @@ +/* Provide access to the last buffer returned by localtime() or gmtime(). + + Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* written by Jim Meyering */ + +#include <config.h> + +/* Specification. */ +#include "localtime-buffer.h" + +#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME + +static struct tm tm_zero_buffer; +struct tm *localtime_buffer_addr = &tm_zero_buffer; + +/* This is a wrapper for localtime. + + On the first call, record the address of the static buffer that + localtime uses for its result. */ + +struct tm * +rpl_localtime (time_t const *timep) +{ + struct tm *tm = localtime (timep); + + if (localtime_buffer_addr == &tm_zero_buffer) + localtime_buffer_addr = tm; + + return tm; +} + +/* Same as above, since gmtime and localtime use the same buffer. */ +struct tm * +rpl_gmtime (time_t const *timep) +{ + struct tm *tm = gmtime (timep); + + if (localtime_buffer_addr == &tm_zero_buffer) + localtime_buffer_addr = tm; + + return tm; +} + +#endif diff --git a/lib/localtime-buffer.h b/lib/localtime-buffer.h new file mode 100644 index 0000000..f381ff0 --- /dev/null +++ b/lib/localtime-buffer.h @@ -0,0 +1,27 @@ +/* Provide access to the last buffer returned by localtime() or gmtime(). + + Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +/* written by Jim Meyering */ + +#include <time.h> + +#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME + +/* The address of the last buffer returned by localtime() or gmtime(). */ +extern struct tm *localtime_buffer_addr; + +#endif diff --git a/lib/lseek.c b/lib/lseek.c index 3b2fdf2..e37aadf 100644 --- a/lib/lseek.c +++ b/lib/lseek.c @@ -1,5 +1,5 @@ /* An lseek() function that detects pipes. - Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -24,7 +24,11 @@ /* Get GetFileType. */ # include <windows.h> /* Get _get_osfhandle. */ -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif #else # include <sys/stat.h> #endif diff --git a/lib/lstat.c b/lib/lstat.c index f4dc43e..5873bbd 100644 --- a/lib/lstat.c +++ b/lib/lstat.c @@ -1,6 +1,6 @@ /* Work around a bug of lstat on some systems - Copyright (C) 1997-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 1997-2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ @@ -47,6 +47,8 @@ orig_lstat (const char *filename, struct stat *buf) above. */ # include "sys/stat.h" +# include "stat-time.h" + # include <string.h> # include <errno.h> @@ -66,32 +68,33 @@ orig_lstat (const char *filename, struct stat *buf) int rpl_lstat (const char *file, struct stat *sbuf) { - size_t len; - int lstat_result = orig_lstat (file, sbuf); - - if (lstat_result != 0) - return lstat_result; + int result = orig_lstat (file, sbuf); /* This replacement file can blindly check against '/' rather than using the ISSLASH macro, because all platforms with '\\' either lack symlinks (mingw) or have working lstat (cygwin) and thus do not compile this file. 0 len should have already been filtered out above, with a failure return of ENOENT. */ - len = strlen (file); - if (file[len - 1] != '/' || S_ISDIR (sbuf->st_mode)) - return 0; - - /* At this point, a trailing slash is only permitted on - symlink-to-dir; but it should have found information on the - directory, not the symlink. Call stat() to get info about the - link's referent. Our replacement stat guarantees valid results, - even if the symlink is not pointing to a directory. */ - if (!S_ISLNK (sbuf->st_mode)) + if (result == 0) { - errno = ENOTDIR; - return -1; + if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/') + result = stat_time_normalize (result, sbuf); + else + { + /* At this point, a trailing slash is permitted only on + symlink-to-dir; but it should have found information on the + directory, not the symlink. Call 'stat' to get info about the + link's referent. Our replacement stat guarantees valid results, + even if the symlink is not pointing to a directory. */ + if (!S_ISLNK (sbuf->st_mode)) + { + errno = ENOTDIR; + return -1; + } + result = stat (file, sbuf); + } } - return stat (file, sbuf); + return result; } #endif /* HAVE_LSTAT */ diff --git a/lib/malloc.c b/lib/malloc.c index eeaf12b..471c3ab 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -1,6 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering and Bruno Haible */ diff --git a/lib/malloca.c b/lib/malloca.c new file mode 100644 index 0000000..ebf7a4c --- /dev/null +++ b/lib/malloca.c @@ -0,0 +1,159 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003, 2006-2007, 2009-2018 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +#define _GL_USE_STDLIB_ALLOC 1 +#include <config.h> + +/* Specification. */ +#include "malloca.h" + +#include <stdint.h> + +#include "verify.h" + +/* Silence a warning from clang's MemorySanitizer. */ +#if defined __has_feature +# if __has_feature(memory_sanitizer) +# define NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory"))) +# endif +#endif +#ifndef NO_SANITIZE_MEMORY +# define NO_SANITIZE_MEMORY +#endif + +/* The speed critical point in this file is freea() applied to an alloca() + result: it must be fast, to match the speed of alloca(). The speed of + mmalloca() and freea() in the other case are not critical, because they + are only invoked for big memory sizes. */ + +#if HAVE_ALLOCA + +/* Store the mmalloca() results in a hash table. This is needed to reliably + distinguish a mmalloca() result and an alloca() result. + + Although it is possible that the same pointer is returned by alloca() and + by mmalloca() at different times in the same application, it does not lead + to a bug in freea(), because: + - Before a pointer returned by alloca() can point into malloc()ed memory, + the function must return, and once this has happened the programmer must + not call freea() on it anyway. + - Before a pointer returned by mmalloca() can point into the stack, it + must be freed. The only function that can free it is freea(), and + when freea() frees it, it also removes it from the hash table. */ + +#define MAGIC_NUMBER 0x1415fb4a +#define MAGIC_SIZE sizeof (int) +/* This is how the header info would look like without any alignment + considerations. */ +struct preliminary_header { void *next; int magic; }; +/* But the header's size must be a multiple of sa_alignment_max. */ +#define HEADER_SIZE \ + (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) +union header { + void *next; + struct { + char room[HEADER_SIZE - MAGIC_SIZE]; + int word; + } magic; +}; +verify (HEADER_SIZE == sizeof (union header)); +/* We make the hash table quite big, so that during lookups the probability + of empty hash buckets is quite high. There is no need to make the hash + table resizable, because when the hash table gets filled so much that the + lookup becomes slow, it means that the application has memory leaks. */ +#define HASH_TABLE_SIZE 257 +static void * mmalloca_results[HASH_TABLE_SIZE]; + +#endif + +void * +mmalloca (size_t n) +{ +#if HAVE_ALLOCA + /* Allocate one more word, that serves as an indicator for malloc()ed + memory, so that freea() of an alloca() result is fast. */ + size_t nplus = n + HEADER_SIZE; + + if (nplus >= n) + { + void *p = malloc (nplus); + + if (p != NULL) + { + size_t slot; + union header *h = p; + + p = h + 1; + + /* Put a magic number into the indicator word. */ + h->magic.word = MAGIC_NUMBER; + + /* Enter p into the hash table. */ + slot = (uintptr_t) p % HASH_TABLE_SIZE; + h->next = mmalloca_results[slot]; + mmalloca_results[slot] = p; + + return p; + } + } + /* Out of memory. */ + return NULL; +#else +# if !MALLOC_0_IS_NONNULL + if (n == 0) + n = 1; +# endif + return malloc (n); +#endif +} + +#if HAVE_ALLOCA +void NO_SANITIZE_MEMORY +freea (void *p) +{ + /* mmalloca() may have returned NULL. */ + if (p != NULL) + { + /* Attempt to quickly distinguish the mmalloca() result - which has + a magic indicator word - and the alloca() result - which has an + uninitialized indicator word. It is for this test that sa_increment + additional bytes are allocated in the alloca() case. */ + if (((int *) p)[-1] == MAGIC_NUMBER) + { + /* Looks like a mmalloca() result. To see whether it really is one, + perform a lookup in the hash table. */ + size_t slot = (uintptr_t) p % HASH_TABLE_SIZE; + void **chain = &mmalloca_results[slot]; + for (; *chain != NULL;) + { + union header *h = p; + if (*chain == p) + { + /* Found it. Remove it from the hash table and free it. */ + union header *p_begin = h - 1; + *chain = p_begin->next; + free (p_begin); + return; + } + h = *chain; + chain = &h[-1].next; + } + } + /* At this point, we know it was not a mmalloca() result. */ + } +} +#endif diff --git a/lib/malloca.h b/lib/malloca.h new file mode 100644 index 0000000..499e822 --- /dev/null +++ b/lib/malloca.h @@ -0,0 +1,128 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003-2007, 2009-2018 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _MALLOCA_H +#define _MALLOCA_H + +#include <alloca.h> +#include <stddef.h> +#include <stdlib.h> +#include <stdint.h> + +#include "xalloc-oversized.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call + alloca(N); otherwise it returns NULL. It either returns N bytes of + memory allocated on the stack, that lasts until the function returns, + or NULL. + Use of safe_alloca should be avoided: + - inside arguments of function calls - undefined behaviour, + - in inline functions - the allocation may actually last until the + calling function returns. +*/ +#if HAVE_ALLOCA +/* The OS usually guarantees only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + allocate anything larger than 4096 bytes. Also care for the possibility + of a few compiler-allocated temporary stack slots. + This must be a macro, not a function. */ +# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) +#else +# define safe_alloca(N) ((void) (N), NULL) +#endif + +/* malloca(N) is a safe variant of alloca(N). It allocates N bytes of + memory allocated on the stack, that must be freed using freea() before + the function returns. Upon failure, it returns NULL. */ +#if HAVE_ALLOCA +# define malloca(N) \ + ((N) < 4032 - sa_increment \ + ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ + : mmalloca (N)) +#else +# define malloca(N) \ + mmalloca (N) +#endif +extern void * mmalloca (size_t n); + +/* Free a block of memory allocated through malloca(). */ +#if HAVE_ALLOCA +extern void freea (void *p); +#else +# define freea free +#endif + +/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S). + It allocates an array of N objects, each with S bytes of memory, + on the stack. S must be positive and N must be nonnegative. + The array must be freed using freea() before the function returns. */ +#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s))) + + +#ifdef __cplusplus +} +#endif + + +/* ------------------- Auxiliary, non-public definitions ------------------- */ + +/* Determine the alignment of a type at compile time. */ +#if defined __GNUC__ || defined __IBM__ALIGNOF__ +# define sa_alignof __alignof__ +#elif defined __cplusplus + template <class type> struct sa_alignof_helper { char __slot1; type __slot2; }; +# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2) +#elif defined __hpux + /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#elif defined _AIX + /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#else +# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) +#endif + +enum +{ +/* The desired alignment of memory allocations is the maximum alignment + among all elementary types. */ + sa_alignment_long = sa_alignof (long), + sa_alignment_double = sa_alignof (double), +#if HAVE_LONG_LONG_INT + sa_alignment_longlong = sa_alignof (long long), +#endif + sa_alignment_longdouble = sa_alignof (long double), + sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) +#if HAVE_LONG_LONG_INT + | (sa_alignment_longlong - 1) +#endif + | (sa_alignment_longdouble - 1) + ) + 1, +/* The increment that guarantees room for a magic word must be >= sizeof (int) + and a multiple of sa_alignment_max. */ + sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max +}; + +#endif /* _MALLOCA_H */ diff --git a/lib/malloca.valgrind b/lib/malloca.valgrind new file mode 100644 index 0000000..52f0a50 --- /dev/null +++ b/lib/malloca.valgrind @@ -0,0 +1,7 @@ +# Suppress a valgrind message about use of uninitialized memory in freea(). +# This use is OK because it provides only a speedup. +{ + freea + Memcheck:Cond + fun:freea +} diff --git a/lib/mbchar.c b/lib/mbchar.c index 69675bf..6d2a47e 100644 --- a/lib/mbchar.c +++ b/lib/mbchar.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2006, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/mbchar.h b/lib/mbchar.h index ec24068..55c07e3 100644 --- a/lib/mbchar.h +++ b/lib/mbchar.h @@ -1,5 +1,5 @@ /* Multibyte character data type. - Copyright (C) 2001, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ diff --git a/lib/mbiter.h b/lib/mbiter.h index c3e6f76..49e50a3 100644 --- a/lib/mbiter.h +++ b/lib/mbiter.h @@ -1,5 +1,5 @@ /* Iterating through multibyte strings: macros for multi-byte encodings. - Copyright (C) 2001, 2005, 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c index d4809f6..22ac2c4 100644 --- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2017 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -35,6 +35,13 @@ # include "streq.h" # include "verify.h" +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif verify (sizeof (mbstate_t) >= 4); @@ -74,10 +81,10 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) break; case 3: buf[2] = pstate[3]; - /*FALLTHROUGH*/ + FALLTHROUGH; case 2: buf[1] = pstate[2]; - /*FALLTHROUGH*/ + FALLTHROUGH; case 1: buf[0] = pstate[1]; p = buf; @@ -98,7 +105,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) /* Here m > 0. */ # if __GLIBC__ || defined __UCLIBC__ - /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ + /* Work around bug <https://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ mbtowc (NULL, NULL, 0); # endif { diff --git a/lib/mbsinit.c b/lib/mbsinit.c index 58e0441..921cbf1 100644 --- a/lib/mbsinit.c +++ b/lib/mbsinit.c @@ -1,5 +1,5 @@ /* Test for initial conversion state. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -22,17 +22,7 @@ #include "verify.h" -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ - -/* On native Windows, 'mbstate_t' is defined as 'int'. */ - -int -mbsinit (const mbstate_t *ps) -{ - return ps == NULL || *ps == 0; -} - -#else +#if GNULIB_defined_mbstate_t /* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs() and wcrtomb(), wcsrtombs(). @@ -45,6 +35,7 @@ mbsinit (const mbstate_t *ps) We define the meaning of mbstate_t as follows: - In mb -> wc direction, mbstate_t's first byte contains the number of buffered bytes (in the range 0..3), followed by up to 3 buffered bytes. + See mbrtowc.c. - In wc -> mb direction, mbstate_t contains no information. In other words, it is always in the initial state. */ @@ -58,4 +49,25 @@ mbsinit (const mbstate_t *ps) return pstate == NULL || pstate[0] == 0; } +#else + +int +mbsinit (const mbstate_t *ps) +{ +# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* Native Windows. */ +# ifdef __MINGW32__ + /* On mingw, 'mbstate_t' is defined as 'int'. */ + return ps == NULL || *ps == 0; +# else + /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4-bytes matter. */ + return ps == NULL || *(const unsigned int *)ps == 0; +# endif +# else + /* Minix, HP-UX 11.00, Solaris 2.6, Interix, ... */ + /* Maybe this definition works, maybe not... */ + return ps == NULL || *(const char *)ps == 0; +# endif +} + #endif diff --git a/lib/mbsrtowcs-impl.h b/lib/mbsrtowcs-impl.h index d787c07..2588a88 100644 --- a/lib/mbsrtowcs-impl.h +++ b/lib/mbsrtowcs-impl.h @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) diff --git a/lib/mbsrtowcs-state.c b/lib/mbsrtowcs-state.c index 4c213e4..2ab2618 100644 --- a/lib/mbsrtowcs-state.c +++ b/lib/mbsrtowcs-state.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -23,7 +23,7 @@ mbstate_t _gl_mbsrtowcs_state /* The state must initially be in the "initial state"; so, zero-initialize it. On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, - see <http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00329.html>. + see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>. When it needs an initializer, use 0 or {0} as initializer? 0 only works when mbstate_t is a scalar type (such as when gnulib defines it, or on AIX, IRIX, mingw). {0} works as an initializer in all cases: for a struct diff --git a/lib/mbsrtowcs.c b/lib/mbsrtowcs.c index 7896e94..1da1ce5 100644 --- a/lib/mbsrtowcs.c +++ b/lib/mbsrtowcs.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/mbtowc-impl.h b/lib/mbtowc-impl.h index b53b2eb..633832f 100644 --- a/lib/mbtowc-impl.h +++ b/lib/mbtowc-impl.h @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* We don't need a static internal state, because the encoding is not state dependent, and when mbrtowc returns (size_t)(-2). we throw the result diff --git a/lib/mbtowc.c b/lib/mbtowc.c index 118754f..a212b22 100644 --- a/lib/mbtowc.c +++ b/lib/mbtowc.c @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -1,6 +1,6 @@ /* Functions to compute MD2 message digest of files or memory blocks. according to the definition of MD2 in RFC 1319 from April 1992. - Copyright (C) 1995-1997, 1999-2003, 2005-2006, 2008-2017 Free Software + Copyright (C) 1995-1997, 1999-2003, 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Adapted by Simon Josefsson from public domain Libtomcrypt 1.06 by Tom St Denis. */ @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for MD2 sum library functions. - Copyright (C) 2000-2001, 2003, 2005, 2008-2017 Free Software Foundation, + Copyright (C) 2000-2001, 2003, 2005, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef MD2_H # define MD2_H 1 @@ -1,6 +1,6 @@ /* Functions to compute MD4 message digest of files or memory blocks. according to the definition of MD4 in RFC 1320 from April 1992. - Copyright (C) 1995-1997, 1999-2003, 2005-2006, 2008-2017 Free Software + Copyright (C) 1995-1997, 1999-2003, 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Adapted by Simon Josefsson from gnulib md5.? and Libgcrypt cipher/md4.c . */ @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for MD4 sum library functions. - Copyright (C) 2000-2001, 2003, 2005, 2008-2017 Free Software Foundation, + Copyright (C) 2000-2001, 2003, 2005, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef MD4_H # define MD4_H 1 @@ -1,6 +1,6 @@ /* Functions to compute MD5 message digest of files or memory blocks. according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2017 Free Software + Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ @@ -246,7 +246,8 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ + /* The regions in the following copy operation cannot overlap, + because ctx->buflen < 64 ≤ (left_over + add) & ~63. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~63], ctx->buflen); @@ -288,6 +289,8 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) { md5_process_block (ctx->buffer, 64, ctx); left_over -= 64; + /* The regions in the following copy operation cannot overlap, + because left_over ≤ 64. */ memcpy (ctx->buffer, &ctx->buffer[16], left_over); } ctx->buflen = left_over; @@ -466,3 +469,10 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) ctx->D = D; } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ @@ -1,6 +1,6 @@ /* Declaration of functions and data types used for MD5 sum computing library functions. - Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2017 Free Software + Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MD5_H #define _MD5_H 1 @@ -74,8 +74,8 @@ struct md5_ctx uint32_t D; uint32_t total[2]; - uint32_t buflen; - uint32_t buffer[32]; + uint32_t buflen; /* ≥ 0, ≤ 128 */ + uint32_t buffer[32]; /* 128 bytes; the first buflen bytes are in use */ }; /* @@ -133,3 +133,10 @@ extern int __md5_stream (FILE *stream, void *resblock) __THROW; # endif #endif /* md5.h */ + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/memchr.c b/lib/memchr.c index 3481260..0b47546 100644 --- a/lib/memchr.c +++ b/lib/memchr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2017 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2018 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -21,7 +21,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. */ +along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/memrchr.c b/lib/memrchr.c index fefe16c..99acfd9 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -1,6 +1,6 @@ /* memrchr -- find the last occurrence of a byte in a memory block - Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2017 Free Software + Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2018 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -20,7 +20,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if defined _LIBC # include <memcopy.h> diff --git a/lib/minmax.h b/lib/minmax.h index 6b602a9..33a5305 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -1,5 +1,5 @@ /* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2017 Free Software + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MINMAX_H #define _MINMAX_H diff --git a/lib/mkdir.c b/lib/mkdir.c index 0930974..e993954 100644 --- a/lib/mkdir.c +++ b/lib/mkdir.c @@ -1,7 +1,7 @@ /* On some systems, mkdir ("foo/", 0700) fails because of the trailing slash. On those systems, this wrapper removes the trailing slash. - Copyright (C) 2001, 2003, 2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/mkostemp.c b/lib/mkostemp.c index 56c22a4..df9ecf8 100644 --- a/lib/mkostemp.c +++ b/lib/mkostemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2017 Free Software +/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2018 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if !_LIBC # include <config.h> diff --git a/lib/mkstemp.c b/lib/mkstemp.c index 8083e18..02a7b65 100644 --- a/lib/mkstemp.c +++ b/lib/mkstemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2017 Free Software +/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2018 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if !_LIBC # include <config.h> diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h index 6c8b2e7..92bdda6 100644 --- a/lib/mktime-internal.h +++ b/lib/mktime-internal.h @@ -1,6 +1,6 @@ /* mktime variant that also uses an offset guess - Copyright 2016-2017 Free Software Foundation, Inc. + Copyright 2016-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <time.h> diff --git a/lib/mktime.c b/lib/mktime.c index 998882f..007adf1 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -1,5 +1,5 @@ /* Convert a 'struct tm' to a time_t value. - Copyright (C) 1993-2017 Free Software Foundation, Inc. + Copyright (C) 1993-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Eggert <eggert@twinsun.com>. @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ /* Define this to 1 to have a standalone program to test this implementation of mktime. */ @@ -23,6 +23,19 @@ # define DEBUG_MKTIME 0 #endif +/* The following macros influence what gets defined when this file is compiled: + + Macro/expression Which gnulib module This compilation unit + should define + + NEED_MKTIME_WORKING mktime rpl_mktime + || NEED_MKTIME_WINDOWS + + NEED_MKTIME_INTERNAL mktime-internal mktime_internal + + DEBUG_MKTIME (defined manually) my_mktime, main + */ + #if !defined _LIBC && !DEBUG_MKTIME # include <config.h> #endif @@ -51,6 +64,13 @@ # define mktime my_mktime #endif +#if NEED_MKTIME_WINDOWS /* on native Windows */ +# include <stdlib.h> +# include <string.h> +#endif + +#if NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL || DEBUG_MKTIME + /* A signed type that can represent an integer number of years multiplied by three times the number of seconds in a year. It is needed when converting a tm_year value times the number of seconds @@ -458,25 +478,65 @@ __mktime_internal (struct tm *tp, return t; } +#endif /* NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL || DEBUG_MKTIME */ + +#if NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS || DEBUG_MKTIME +# if NEED_MKTIME_WORKING || DEBUG_MKTIME static mktime_offset_t localtime_offset; +# endif /* Convert *TP to a time_t value. */ time_t mktime (struct tm *tp) { -#ifdef _LIBC +# if NEED_MKTIME_WINDOWS + /* Rectify the value of the environment variable TZ. + There are four possible kinds of such values: + - Traditional US time zone names, e.g. "PST8PDT". Syntax: see + <https://msdn.microsoft.com/en-us/library/90s5c885.aspx> + - Time zone names based on geography, that contain one or more + slashes, e.g. "Europe/Moscow". + - Time zone names based on geography, without slashes, e.g. + "Singapore". + - Time zone names that contain explicit DST rules. Syntax: see + <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03> + The Microsoft CRT understands only the first kind. It produces incorrect + results if the value of TZ is of the other kinds. + But in a Cygwin environment, /etc/profile.d/tzset.sh sets TZ to a value + of the second kind for most geographies, or of the first kind in a few + other geographies. If it is of the second kind, neutralize it. For the + Microsoft CRT, an absent or empty TZ means the time zone that the user + has set in the Windows Control Panel. + If the value of TZ is of the third or fourth kind -- Cygwin programs + understand these syntaxes as well --, it does not matter whether we + neutralize it or not, since these values occur only when a Cygwin user + has set TZ explicitly; this case is 1. rare and 2. under the user's + responsibility. */ + const char *tz = getenv ("TZ"); + if (tz != NULL && strchr (tz, '/') != NULL) + _putenv ("TZ="); +# endif + +# if NEED_MKTIME_WORKING || DEBUG_MKTIME +# ifdef _LIBC /* POSIX.1 8.1.1 requires that whenever mktime() is called, the time zone names contained in the external variable 'tzname' shall be set as if the tzset() function had been called. */ __tzset (); -#elif HAVE_TZSET +# elif HAVE_TZSET tzset (); -#endif +# endif return __mktime_internal (tp, __localtime_r, &localtime_offset); +# else +# undef mktime + return mktime (tp); +# endif } +#endif /* NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS || DEBUG_MKTIME */ + #ifdef weak_alias weak_alias (mktime, timelocal) #endif diff --git a/lib/msvc-inval.c b/lib/msvc-inval.c index 7139e93..0f19a09 100644 --- a/lib/msvc-inval.c +++ b/lib/msvc-inval.c @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/msvc-inval.h b/lib/msvc-inval.h index 6e216d6..8e7ff30 100644 --- a/lib/msvc-inval.h +++ b/lib/msvc-inval.h @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MSVC_INVAL_H #define _MSVC_INVAL_H @@ -95,7 +95,7 @@ extern void gl_msvc_inval_ensure_handler (void); /* Gnulib can define its own status codes, as described in the page "Raising Software Exceptions" on microsoft.com - <http://msdn.microsoft.com/en-us/library/het71c37.aspx>. + <https://msdn.microsoft.com/en-us/library/het71c37.aspx>. Our status codes are composed of - 0xE0000000, mandatory for all user-defined status codes, - 0x474E550, a API identifier ("GNU"), @@ -106,7 +106,7 @@ extern void gl_msvc_inval_ensure_handler (void); # if defined _MSC_VER /* A compiler that supports __try/__except, as described in the page "try-except statement" on microsoft.com - <http://msdn.microsoft.com/en-us/library/s58ftw19.aspx>. + <https://msdn.microsoft.com/en-us/library/s58ftw19.aspx>. With __try/__except, we can use the multithread-safe exception handling. */ # ifdef __cplusplus diff --git a/lib/msvc-nothrow.c b/lib/msvc-nothrow.c index d127eb4..785733e 100644 --- a/lib/msvc-nothrow.c +++ b/lib/msvc-nothrow.c @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -24,7 +24,9 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> -#include "msvc-inval.h" +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif #undef _get_osfhandle diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h index c70efc7..f7a7f8a 100644 --- a/lib/msvc-nothrow.h +++ b/lib/msvc-nothrow.h @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MSVC_NOTHROW_H #define _MSVC_NOTHROW_H diff --git a/lib/nanosleep.c b/lib/nanosleep.c index 4f65802..8c3be40 100644 --- a/lib/nanosleep.c +++ b/lib/nanosleep.c @@ -1,6 +1,6 @@ /* Provide a replacement for the POSIX nanosleep function. - Copyright (C) 1999-2000, 2002, 2004-2017 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2004-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering and Bruno Haible for the native Windows part */ diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 6d95f1f..07ab17b 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -1,5 +1,5 @@ /* Provide a netdb.h header file for systems lacking it (read: MinGW). - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This file is supposed to be used on platforms that lack <netdb.h>. It is intended to provide definitions and prototypes needed by an diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h index 9411b9f..0f26cf5 100644 --- a/lib/netinet_in.in.h +++ b/lib/netinet_in.in.h @@ -1,5 +1,5 @@ /* Substitute for <netinet/in.h>. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_NETINET_IN_H diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c index 270570f..725ccf6 100644 --- a/lib/nl_langinfo.c +++ b/lib/nl_langinfo.c @@ -1,6 +1,6 @@ /* nl_langinfo() replacement: query locale dependent information. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -1,5 +1,5 @@ /* Open a descriptor to a file. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -38,6 +38,8 @@ orig_open (const char *filename, int flags, mode_t mode) this include because of the preliminary #include <fcntl.h> above. */ #include "fcntl.h" +#include "cloexec.h" + #include <errno.h> #include <stdarg.h> #include <string.h> @@ -52,6 +54,13 @@ orig_open (const char *filename, int flags, mode_t mode) int open (const char *filename, int flags, ...) { + /* 0 = unknown, 1 = yes, -1 = no. */ +#if GNULIB_defined_O_CLOEXEC + int have_cloexec = -1; +#else + static int have_cloexec; +#endif + mode_t mode; int fd; @@ -115,7 +124,25 @@ open (const char *filename, int flags, ...) } #endif - fd = orig_open (filename, flags, mode); + fd = orig_open (filename, + flags & ~(have_cloexec <= 0 ? O_CLOEXEC : 0), mode); + + if (flags & O_CLOEXEC) + { + if (! have_cloexec) + { + if (0 <= fd) + have_cloexec = 1; + else if (errno == EINVAL) + { + fd = orig_open (filename, flags & ~O_CLOEXEC, mode); + have_cloexec = -1; + } + } + if (have_cloexec < 0 && 0 <= fd) + set_cloexec_flag (fd, true); + } + #if REPLACE_FCHDIR /* Implementing fchdir and fdopendir requires the ability to open a diff --git a/lib/pathmax.h b/lib/pathmax.h index aa0730e..1eafb49 100644 --- a/lib/pathmax.h +++ b/lib/pathmax.h @@ -1,5 +1,5 @@ /* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2017 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _PATHMAX_H # define _PATHMAX_H @@ -68,7 +68,7 @@ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, section "Maximum Path Length Limitation", - <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath> + <https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath> explains that the maximum size of a filename, including the terminating NUL byte, is 260 = 3 + 256 + 1. This is the same value as diff --git a/lib/pipe-safer.c b/lib/pipe-safer.c index d24a1eb..1669d90 100644 --- a/lib/pipe-safer.c +++ b/lib/pipe-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ @@ -1,5 +1,5 @@ /* Create a pipe. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/pipe2-safer.c b/lib/pipe2-safer.c index 6db419b..71fef9e 100644 --- a/lib/pipe2-safer.c +++ b/lib/pipe2-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe2, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ diff --git a/lib/pipe2.c b/lib/pipe2.c index 830f006..807ba6a 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -1,5 +1,5 @@ /* Create a pipe, with specific opening flags. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/printf-args.c b/lib/printf-args.c index fec7e62..1079e0a 100644 --- a/lib/printf-args.c +++ b/lib/printf-args.c @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2017 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This file can be parametrized with the following macros: ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. diff --git a/lib/printf-args.h b/lib/printf-args.h index 36cab2a..111e8a5 100644 --- a/lib/printf-args.h +++ b/lib/printf-args.h @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2017 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H diff --git a/lib/printf-parse.c b/lib/printf-parse.c index b9e04ae..ee5c3be 100644 --- a/lib/printf-parse.c +++ b/lib/printf-parse.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This file can be parametrized with the following macros: CHAR_T The element type of the format string. diff --git a/lib/printf-parse.h b/lib/printf-parse.h index b9bfa85..16d817e 100644 --- a/lib/printf-parse.h +++ b/lib/printf-parse.h @@ -1,5 +1,5 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2017 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _PRINTF_PARSE_H #define _PRINTF_PARSE_H diff --git a/lib/quote.h b/lib/quote.h index 2e58fb5..eedc283 100644 --- a/lib/quote.h +++ b/lib/quote.h @@ -1,6 +1,6 @@ /* quote.h - prototypes for quote.c - Copyright (C) 1998-2001, 2003, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1998-2001, 2003, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef QUOTE_H_ # define QUOTE_H_ 1 diff --git a/lib/quotearg.c b/lib/quotearg.c index 26903c7..fe68dca 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -1,6 +1,6 @@ /* quotearg.c - quote arguments for output - Copyright (C) 1998-2002, 2004-2017 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert <eggert@twinsun.com> */ @@ -54,6 +54,14 @@ #define INT_BITS (sizeof (int) * CHAR_BIT) +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + struct quoting_options { /* Basic quoting style. */ @@ -310,7 +318,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case c_maybe_quoting_style: quoting_style = c_quoting_style; elide_outer_quotes = true; - /* Fall through. */ + FALLTHROUGH; case c_quoting_style: if (!elide_outer_quotes) STORE ('"'); @@ -349,7 +357,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, for your locale. If you don't know what to put here, please see - <http://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> + <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages> and use glyphs suitable for your language. */ left_quote = gettext_quote (N_("`"), quoting_style); right_quote = gettext_quote (N_("'"), quoting_style); @@ -365,14 +373,14 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case shell_escape_quoting_style: backslash_escapes = true; - /* Fall through. */ + FALLTHROUGH; case shell_quoting_style: elide_outer_quotes = true; - /* Fall through. */ + FALLTHROUGH; case shell_escape_always_quoting_style: if (!elide_outer_quotes) backslash_escapes = true; - /* Fall through. */ + FALLTHROUGH; case shell_always_quoting_style: quoting_style = shell_always_quoting_style; if (!elide_outer_quotes) @@ -505,7 +513,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, if (quoting_style == shell_always_quoting_style && elide_outer_quotes) goto force_outer_quoting_style; - /* Fall through. */ + /* fall through */ c_escape: if (backslash_escapes) { @@ -517,14 +525,14 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case '{': case '}': /* sometimes special if isolated */ if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1)) break; - /* Fall through. */ + FALLTHROUGH; case '#': case '~': if (i != 0) break; - /* Fall through. */ + FALLTHROUGH; case ' ': c_and_shell_quote_compat = true; - /* Fall through. */ + FALLTHROUGH; case '!': /* special in bash */ case '"': case '$': case '&': case '(': case ')': case '*': case ';': @@ -879,8 +887,9 @@ quotearg_n_options (int n, char const *arg, size_t argsize, if (nslots <= n) { bool preallocated = (sv == &slotvec0); + int nmax = MIN (INT_MAX, MIN (PTRDIFF_MAX, SIZE_MAX) / sizeof *sv) - 1; - if (MIN (INT_MAX, MIN (PTRDIFF_MAX, SIZE_MAX) / sizeof *sv) <= n) + if (nmax < n) xalloc_die (); slotvec = sv = xrealloc (preallocated ? NULL : sv, (n + 1) * sizeof *sv); @@ -1071,3 +1080,10 @@ quote (char const *arg) { return quote_n (0, arg); } + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/quotearg.h b/lib/quotearg.h index b82aa00..0584c56 100644 --- a/lib/quotearg.h +++ b/lib/quotearg.h @@ -1,6 +1,6 @@ /* quotearg.h - quote arguments for output - Copyright (C) 1998-2002, 2004, 2006, 2008-2017 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert <eggert@twinsun.com> */ diff --git a/lib/raise.c b/lib/raise.c index d3325a6..3a29339 100644 --- a/lib/raise.c +++ b/lib/raise.c @@ -1,6 +1,6 @@ /* Provide a non-threads replacement for the POSIX raise function. - Copyright (C) 2002-2003, 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering and Bruno Haible */ @@ -27,7 +27,9 @@ # include <errno.h> -# include "msvc-inval.h" +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif # undef raise diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c index bba95b6..912bfeb 100644 --- a/lib/rawmemchr.c +++ b/lib/rawmemchr.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -1,6 +1,6 @@ /* recv.c --- wrappers for Windows recv function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/ref-add.sin b/lib/ref-add.sin index 3913e99..1bbf38f 100644 --- a/lib/ref-add.sin +++ b/lib/ref-add.sin @@ -1,6 +1,6 @@ # Add this package to a list of references stored in a text file. # -# Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, see <http://www.gnu.org/licenses/>. +# with this program; if not, see <https://www.gnu.org/licenses/>. # # Written by Bruno Haible <haible@clisp.cons.org>. # diff --git a/lib/ref-del.sin b/lib/ref-del.sin index eeff947..5965092 100644 --- a/lib/ref-del.sin +++ b/lib/ref-del.sin @@ -1,6 +1,6 @@ # Remove this package from a list of references stored in a text file. # -# Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, see <http://www.gnu.org/licenses/>. +# with this program; if not, see <https://www.gnu.org/licenses/>. # # Written by Bruno Haible <haible@clisp.cons.org>. # diff --git a/lib/regcomp.c b/lib/regcomp.c index 6aaa6b1..c2c577a 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifdef _LIBC # include <locale/weight.h> @@ -59,7 +59,7 @@ static reg_errcode_t calc_inveclosure (re_dfa_t *dfa); static Idx fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax); static int peek_token (re_token_t *token, re_string_t *input, - reg_syntax_t syntax) internal_function; + reg_syntax_t syntax); static bin_tree_t *parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax, reg_errcode_t *err); static bin_tree_t *parse_reg_exp (re_string_t *regexp, regex_t *preg, @@ -516,6 +516,7 @@ regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags) return (int) ret; } #ifdef _LIBC +libc_hidden_def (__regcomp) weak_alias (__regcomp, regcomp) #endif @@ -658,6 +659,7 @@ regfree (regex_t *preg) preg->translate = NULL; } #ifdef _LIBC +libc_hidden_def (__regfree) weak_alias (__regfree, regfree) #endif @@ -699,7 +701,7 @@ re_comp (const char *s) if (re_comp_buf.fastmap == NULL) { - re_comp_buf.fastmap = (char *) malloc (SBC_MAX); + re_comp_buf.fastmap = re_malloc (char, SBC_MAX); if (re_comp_buf.fastmap == NULL) return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) REG_ESPACE]); @@ -935,7 +937,6 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) character used by some operators like "\<", "\>", etc. */ static void -internal_function init_word_char (re_dfa_t *dfa) { int i = 0; @@ -944,12 +945,15 @@ init_word_char (re_dfa_t *dfa) dfa->word_ops_used = 1; if (BE (dfa->map_notascii == 0, 1)) { + /* Avoid uint32_t and uint64_t as some non-GCC platforms lack + them, an issue when this code is used in Gnulib. */ bitset_word_t bits0 = 0x00000000; bitset_word_t bits1 = 0x03ff0000; bitset_word_t bits2 = 0x87fffffe; bitset_word_t bits3 = 0x07fffffe; if (BITSET_WORD_BITS == 64) { + /* Pacify gcc -Woverflow on 32-bit platformns. */ dfa->word_char[0] = bits1 << 31 << 1 | bits0; dfa->word_char[1] = bits3 << 31 << 1 | bits2; i = 2; @@ -1193,7 +1197,7 @@ analyze (regex_t *preg) break; if (i == preg->re_nsub) { - free (dfa->subexp_map); + re_free (dfa->subexp_map); dfa->subexp_map = NULL; } } @@ -1490,7 +1494,6 @@ link_nfa_nodes (void *extra, bin_tree_t *node) to their own constraint. */ static reg_errcode_t -internal_function duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, Idx root_node, unsigned int init_constraint) { @@ -1782,7 +1785,6 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) We must not use this function inside bracket expressions. */ static void -internal_function fetch_token (re_token_t *result, re_string_t *input, reg_syntax_t syntax) { re_string_skip_bytes (input, peek_token (result, input, syntax)); @@ -1792,7 +1794,6 @@ fetch_token (re_token_t *result, re_string_t *input, reg_syntax_t syntax) We must not use this function inside bracket expressions. */ static int -internal_function peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax) { unsigned char c; @@ -2031,7 +2032,6 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax) We must not use this function out of bracket expressions. */ static int -internal_function peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax) { unsigned char c; @@ -2078,16 +2078,18 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax) case '.': token->type = OP_OPEN_COLL_ELEM; break; + case '=': token->type = OP_OPEN_EQUIV_CLASS; break; + case ':': if (syntax & RE_CHAR_CLASSES) { token->type = OP_OPEN_CHAR_CLASS; break; } - /* else fall through. */ + FALLTHROUGH; default: token->type = CHARACTER; token->opr.c = c; @@ -2289,16 +2291,19 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, } #endif break; + case OP_OPEN_SUBEXP: tree = parse_sub_exp (regexp, preg, token, syntax, nest + 1, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; break; + case OP_OPEN_BRACKET: tree = parse_bracket_exp (regexp, dfa, token, syntax, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; break; + case OP_BACK_REF: if (!BE (dfa->completed_bkref_map & (1 << token->opr.idx), 1)) { @@ -2315,13 +2320,14 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, ++dfa->nbackref; dfa->has_mb_node = 1; break; + case OP_OPEN_DUP_NUM: if (syntax & RE_CONTEXT_INVALID_DUP) { *err = REG_BADRPT; return NULL; } - /* FALLTHROUGH */ + FALLTHROUGH; case OP_DUP_ASTERISK: case OP_DUP_PLUS: case OP_DUP_QUESTION: @@ -2335,7 +2341,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, fetch_token (token, regexp, syntax); return parse_expression (regexp, preg, token, syntax, nest, err); } - /* else fall through */ + FALLTHROUGH; case OP_CLOSE_SUBEXP: if ((token->type == OP_CLOSE_SUBEXP) && !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)) @@ -2343,7 +2349,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, *err = REG_ERPAREN; return NULL; } - /* else fall through */ + FALLTHROUGH; case OP_CLOSE_DUP_NUM: /* We treat it as a normal character. */ @@ -2358,6 +2364,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, return NULL; } break; + case ANCHOR: if ((token->opr.ctx_type & (WORD_DELIM | NOT_WORD_DELIM | WORD_FIRST | WORD_LAST)) @@ -2402,6 +2409,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, it must not be "<ANCHOR(^)><REPEAT(*)>". */ fetch_token (token, regexp, syntax); return tree; + case OP_PERIOD: tree = create_token_tree (dfa, NULL, NULL, token); if (BE (tree == NULL, 0)) @@ -2412,6 +2420,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, if (dfa->mb_cur_max > 1) dfa->has_mb_node = 1; break; + case OP_WORD: case OP_NOTWORD: tree = build_charclass_op (dfa, regexp->trans, @@ -2421,6 +2430,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; break; + case OP_SPACE: case OP_NOTSPACE: tree = build_charclass_op (dfa, regexp->trans, @@ -2430,12 +2440,15 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; break; + case OP_ALT: case END_OF_RE: return NULL; + case BACK_SLASH: *err = REG_EESCAPE; return NULL; + default: /* Must not happen? */ #ifdef DEBUG @@ -2693,7 +2706,6 @@ parse_byte (unsigned char b, re_charset_t *mbcset) update it. */ static reg_errcode_t -internal_function # ifdef RE_ENABLE_I18N build_range_exp (const reg_syntax_t syntax, bitset_t sbcset, @@ -2819,7 +2831,6 @@ build_range_exp (const reg_syntax_t syntax, pointer argument since we may update it. */ static reg_errcode_t -internal_function # ifdef RE_ENABLE_I18N build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, Idx *coll_sym_alloc, const unsigned char *name) diff --git a/lib/regex.c b/lib/regex.c index b46308b..499e1f0 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/regex.h b/lib/regex.h index 18b8cbd..cf9a40c 100644 --- a/lib/regex.h +++ b/lib/regex.h @@ -1,6 +1,6 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2017 Free Software + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _REGEX_H #define _REGEX_H 1 diff --git a/lib/regex_internal.c b/lib/regex_internal.c index 9546b78..df27f69 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -15,19 +15,19 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ static void re_string_construct_common (const char *str, Idx len, re_string_t *pstr, RE_TRANSLATE_TYPE trans, bool icase, - const re_dfa_t *dfa) internal_function; + const re_dfa_t *dfa); static re_dfastate_t *create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, - re_hashval_t hash) internal_function; + re_hashval_t hash); static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes, unsigned int context, - re_hashval_t hash) internal_function; + re_hashval_t hash); /* Functions for string operation. */ @@ -35,7 +35,7 @@ static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa, re_string_reconstruct before using the object. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len, RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { @@ -63,7 +63,7 @@ re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len, /* This function allocate the buffers, and initialize them. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_string_construct (re_string_t *pstr, const char *str, Idx len, RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) { @@ -126,7 +126,7 @@ re_string_construct (re_string_t *pstr, const char *str, Idx len, /* Helper functions for re_string_allocate, and re_string_construct. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) { #ifdef RE_ENABLE_I18N @@ -166,7 +166,6 @@ re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) static void -internal_function re_string_construct_common (const char *str, Idx len, re_string_t *pstr, RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa) @@ -198,7 +197,6 @@ re_string_construct_common (const char *str, Idx len, re_string_t *pstr, built and starts from PSTR->VALID_LEN. */ static void -internal_function build_wcs_buffer (re_string_t *pstr) { #ifdef _LIBC @@ -267,7 +265,7 @@ build_wcs_buffer (re_string_t *pstr) but for REG_ICASE. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ build_wcs_upper_buffer (re_string_t *pstr) { mbstate_t prev_st; @@ -484,7 +482,6 @@ build_wcs_upper_buffer (re_string_t *pstr) Return the index. */ static Idx -internal_function re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc) { mbstate_t prev_st; @@ -525,7 +522,6 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc) This function is used in case of REG_ICASE. */ static void -internal_function build_upper_buffer (re_string_t *pstr) { Idx char_idx, end_idx; @@ -545,7 +541,6 @@ build_upper_buffer (re_string_t *pstr) /* Apply TRANS to the buffer in PSTR. */ static void -internal_function re_string_translate_buffer (re_string_t *pstr) { Idx buf_idx, end_idx; @@ -566,7 +561,7 @@ re_string_translate_buffer (re_string_t *pstr) convert to upper case in case of REG_ICASE, apply translation. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) { Idx offset; @@ -829,7 +824,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) } static unsigned char -internal_function __attribute__ ((pure)) +__attribute__ ((pure)) re_string_peek_byte_case (const re_string_t *pstr, Idx idx) { int ch; @@ -866,7 +861,6 @@ re_string_peek_byte_case (const re_string_t *pstr, Idx idx) } static unsigned char -internal_function re_string_fetch_byte_case (re_string_t *pstr) { if (BE (!pstr->mbs_allocated, 1)) @@ -904,7 +898,6 @@ re_string_fetch_byte_case (re_string_t *pstr) } static void -internal_function re_string_destruct (re_string_t *pstr) { #ifdef RE_ENABLE_I18N @@ -918,7 +911,6 @@ re_string_destruct (re_string_t *pstr) /* Return the context at IDX in INPUT. */ static unsigned int -internal_function re_string_context_at (const re_string_t *input, Idx idx, int eflags) { int c; @@ -963,7 +955,7 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags) /* Functions for set operation. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_alloc (re_node_set *set, Idx size) { set->alloc = size; @@ -975,7 +967,7 @@ re_node_set_alloc (re_node_set *set, Idx size) } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_init_1 (re_node_set *set, Idx elem) { set->alloc = 1; @@ -991,7 +983,7 @@ re_node_set_init_1 (re_node_set *set, Idx elem) } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2) { set->alloc = 2; @@ -1021,7 +1013,7 @@ re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2) } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_init_copy (re_node_set *dest, const re_node_set *src) { dest->nelem = src->nelem; @@ -1046,7 +1038,7 @@ re_node_set_init_copy (re_node_set *dest, const re_node_set *src) Note: We assume dest->elems is NULL, when dest->alloc is 0. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, const re_node_set *src2) { @@ -1137,7 +1129,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, DEST. Return value indicate the error code or REG_NOERROR if succeeded. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_init_union (re_node_set *dest, const re_node_set *src1, const re_node_set *src2) { @@ -1190,7 +1182,7 @@ re_node_set_init_union (re_node_set *dest, const re_node_set *src1, DEST. Return value indicate the error code or REG_NOERROR if succeeded. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_merge (re_node_set *dest, const re_node_set *src) { Idx is, id, sbase, delta; @@ -1273,7 +1265,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) Return true if successful. */ static bool -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_insert (re_node_set *set, Idx elem) { Idx idx; @@ -1325,7 +1317,7 @@ re_node_set_insert (re_node_set *set, Idx elem) Return true if successful. */ static bool -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_node_set_insert_last (re_node_set *set, Idx elem) { /* Realloc if we need. */ @@ -1348,7 +1340,7 @@ re_node_set_insert_last (re_node_set *set, Idx elem) Return true if SET1 and SET2 are equivalent. */ static bool -internal_function __attribute__ ((pure)) +__attribute__ ((pure)) re_node_set_compare (const re_node_set *set1, const re_node_set *set2) { Idx i; @@ -1363,7 +1355,7 @@ re_node_set_compare (const re_node_set *set1, const re_node_set *set2) /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ static Idx -internal_function __attribute__ ((pure)) +__attribute__ ((pure)) re_node_set_contains (const re_node_set *set, Idx elem) { __re_size_t idx, right, mid; @@ -1385,7 +1377,6 @@ re_node_set_contains (const re_node_set *set, Idx elem) } static void -internal_function re_node_set_remove_at (re_node_set *set, Idx idx) { if (idx < 0 || idx >= set->nelem) @@ -1400,7 +1391,6 @@ re_node_set_remove_at (re_node_set *set, Idx idx) Or return -1 if an error occurred. */ static Idx -internal_function re_dfa_add_node (re_dfa_t *dfa, re_token_t token) { if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0)) @@ -1454,7 +1444,6 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) } static re_hashval_t -internal_function calc_state_hash (const re_node_set *nodes, unsigned int context) { re_hashval_t hash = nodes->nelem + context; @@ -1474,7 +1463,7 @@ calc_state_hash (const re_node_set *nodes, unsigned int context) optimization. */ static re_dfastate_t * -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa, const re_node_set *nodes) { @@ -1522,7 +1511,7 @@ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa, optimization. */ static re_dfastate_t * -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa, const re_node_set *nodes, unsigned int context) { @@ -1618,7 +1607,7 @@ free_state (re_dfastate_t *state) Return the new state if succeeded, otherwise return NULL. */ static re_dfastate_t * -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, re_hashval_t hash) { @@ -1668,7 +1657,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, Return the new state if succeeded, otherwise return NULL. */ static re_dfastate_t * -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes, unsigned int context, re_hashval_t hash) { diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 3580c45..88add80 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _REGEX_INTERNAL_H #define _REGEX_INTERNAL_H 1 @@ -102,6 +102,7 @@ __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) # endif #else +# undef gettext # define gettext(msgid) (msgid) #endif @@ -437,23 +438,19 @@ struct re_dfa_t; typedef struct re_dfa_t re_dfa_t; #ifndef _LIBC -# define internal_function # define IS_IN(libc) false #endif static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, - Idx new_buf_len) - internal_function; + Idx new_buf_len); #ifdef RE_ENABLE_I18N -static void build_wcs_buffer (re_string_t *pstr) internal_function; -static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) - internal_function; +static void build_wcs_buffer (re_string_t *pstr); +static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr); #endif /* RE_ENABLE_I18N */ -static void build_upper_buffer (re_string_t *pstr) internal_function; -static void re_string_translate_buffer (re_string_t *pstr) internal_function; +static void build_upper_buffer (re_string_t *pstr); +static void re_string_translate_buffer (re_string_t *pstr); static unsigned int re_string_context_at (const re_string_t *input, Idx idx, - int eflags) - internal_function __attribute__ ((pure)); + int eflags) __attribute__ ((pure)); #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) @@ -830,7 +827,7 @@ bitset_mask (bitset_t dest, const bitset_t src) #ifdef RE_ENABLE_I18N /* Functions for re_string. */ static int -internal_function __attribute__ ((pure, unused)) +__attribute__ ((pure, unused)) re_string_char_size_at (const re_string_t *pstr, Idx idx) { int byte_idx; @@ -843,7 +840,7 @@ re_string_char_size_at (const re_string_t *pstr, Idx idx) } static wint_t -internal_function __attribute__ ((pure, unused)) +__attribute__ ((pure, unused)) re_string_wchar_at (const re_string_t *pstr, Idx idx) { if (pstr->mb_cur_max == 1) @@ -856,7 +853,7 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx) # endif static int -internal_function __attribute__ ((pure, unused)) +__attribute__ ((pure, unused)) re_string_elem_size_at (const re_string_t *pstr, Idx idx) { # ifdef _LIBC @@ -898,4 +895,12 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) # define __attribute_warn_unused_result__ /* empty */ #endif +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + #endif /* _REGEX_INTERNAL_H */ diff --git a/lib/regexec.c b/lib/regexec.c index 45bc796..fc18850 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -15,192 +15,162 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, - Idx n) internal_function; -static void match_ctx_clean (re_match_context_t *mctx) internal_function; -static void match_ctx_free (re_match_context_t *cache) internal_function; + Idx n); +static void match_ctx_clean (re_match_context_t *mctx); +static void match_ctx_free (re_match_context_t *cache); static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, Idx node, - Idx str_idx, Idx from, Idx to) - internal_function; -static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) - internal_function; + Idx str_idx, Idx from, Idx to); +static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx); static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, Idx node, - Idx str_idx) internal_function; + Idx str_idx); static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop, - Idx node, Idx str_idx) - internal_function; + Idx node, Idx str_idx); static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, re_dfastate_t **limited_sts, Idx last_node, - Idx last_str_idx) - internal_function; + Idx last_str_idx); static reg_errcode_t re_search_internal (const regex_t *preg, const char *string, Idx length, Idx start, Idx last_start, Idx stop, size_t nmatch, regmatch_t pmatch[], - int eflags) internal_function; + int eflags); static regoff_t re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, regoff_t range, struct re_registers *regs, - Idx stop, bool ret_len) internal_function; + Idx stop, bool ret_len); static regoff_t re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, - bool ret_len) internal_function; + bool ret_len); static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, - Idx nregs, int regs_allocated) internal_function; -static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx) - internal_function; + Idx nregs, int regs_allocated); +static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx); static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match, - Idx *p_match_first) internal_function; + Idx *p_match_first); static Idx check_halt_state_context (const re_match_context_t *mctx, - const re_dfastate_t *state, Idx idx) - internal_function; + const re_dfastate_t *state, Idx idx); static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, regmatch_t *prev_idx_match, Idx cur_node, - Idx cur_idx, Idx nmatch) internal_function; + Idx cur_idx, Idx nmatch); static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, Idx nregs, regmatch_t *regs, - re_node_set *eps_via_nodes) - internal_function; + re_node_set *eps_via_nodes); static reg_errcode_t set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, - bool fl_backtrack) internal_function; -static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs) - internal_function; + bool fl_backtrack); +static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs); #ifdef RE_ENABLE_I18N static int sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, - Idx node_idx, Idx str_idx, Idx max_str_idx) - internal_function; + Idx node_idx, Idx str_idx, Idx max_str_idx); #endif /* RE_ENABLE_I18N */ static reg_errcode_t sift_states_backward (const re_match_context_t *mctx, - re_sift_context_t *sctx) - internal_function; + re_sift_context_t *sctx); static reg_errcode_t build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, - re_node_set *cur_dest) - internal_function; + re_node_set *cur_dest); static reg_errcode_t update_cur_sifted_state (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, - re_node_set *dest_nodes) - internal_function; + re_node_set *dest_nodes); static reg_errcode_t add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes, - const re_node_set *candidates) - internal_function; + const re_node_set *candidates); static bool check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits, Idx dst_node, Idx dst_idx, Idx src_node, - Idx src_idx) internal_function; + Idx src_idx); static int check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, Idx subexp_idx, - Idx from_node, Idx bkref_idx) - internal_function; + Idx from_node, Idx bkref_idx); static int check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit, Idx subexp_idx, Idx node, Idx str_idx, - Idx bkref_idx) internal_function; + Idx bkref_idx); static reg_errcode_t check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, struct re_backref_cache_entry *bkref_ents, - Idx str_idx) internal_function; + Idx str_idx); static reg_errcode_t sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, - Idx str_idx, const re_node_set *candidates) - internal_function; + Idx str_idx, const re_node_set *candidates); static reg_errcode_t merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst, - re_dfastate_t **src, Idx num) - internal_function; + re_dfastate_t **src, Idx num); static re_dfastate_t *find_recover_state (reg_errcode_t *err, - re_match_context_t *mctx) internal_function; + re_match_context_t *mctx); static re_dfastate_t *transit_state (reg_errcode_t *err, re_match_context_t *mctx, - re_dfastate_t *state) internal_function; + re_dfastate_t *state); static re_dfastate_t *merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, - re_dfastate_t *next_state) - internal_function; + re_dfastate_t *next_state); static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, - Idx str_idx) internal_function; + Idx str_idx); #if 0 static re_dfastate_t *transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx, - re_dfastate_t *pstate) - internal_function; + re_dfastate_t *pstate); #endif #ifdef RE_ENABLE_I18N static reg_errcode_t transit_state_mb (re_match_context_t *mctx, - re_dfastate_t *pstate) - internal_function; + re_dfastate_t *pstate); #endif /* RE_ENABLE_I18N */ static reg_errcode_t transit_state_bkref (re_match_context_t *mctx, - const re_node_set *nodes) - internal_function; + const re_node_set *nodes); static reg_errcode_t get_subexp (re_match_context_t *mctx, - Idx bkref_node, Idx bkref_str_idx) - internal_function; + Idx bkref_node, Idx bkref_str_idx); static reg_errcode_t get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, re_sub_match_last_t *sub_last, - Idx bkref_node, Idx bkref_str) - internal_function; + Idx bkref_node, Idx bkref_str); static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, - Idx subexp_idx, int type) internal_function; + Idx subexp_idx, int type); static reg_errcode_t check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, Idx top_str, Idx last_node, Idx last_str, - int type) internal_function; + int type); static reg_errcode_t check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, re_node_set *cur_nodes, - re_node_set *next_nodes) - internal_function; + re_node_set *next_nodes); static reg_errcode_t check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, - Idx ex_subexp, int type) - internal_function; + Idx ex_subexp, int type); static reg_errcode_t check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes, Idx target, Idx ex_subexp, - int type) internal_function; + int type); static reg_errcode_t expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Idx cur_str, - Idx subexp_num, int type) - internal_function; -static bool build_trtable (const re_dfa_t *dfa, - re_dfastate_t *state) internal_function; + Idx subexp_num, int type); +static bool build_trtable (const re_dfa_t *dfa, re_dfastate_t *state); #ifdef RE_ENABLE_I18N static int check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, - const re_string_t *input, Idx idx) - internal_function; + const re_string_t *input, Idx idx); # ifdef _LIBC static unsigned int find_collation_sequence_value (const unsigned char *mbs, - size_t name_len) - internal_function; + size_t name_len); # endif /* _LIBC */ #endif /* RE_ENABLE_I18N */ static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *states_node, - bitset_t *states_ch) internal_function; + bitset_t *states_ch); static bool check_node_accept (const re_match_context_t *mctx, - const re_token_t *node, Idx idx) - internal_function; -static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len) - internal_function; + const re_token_t *node, Idx idx); +static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len); /* Entry point for POSIX code. */ @@ -252,6 +222,8 @@ regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string, } #ifdef _LIBC +libc_hidden_def (__regexec) + # include <shlib-compat.h> versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4); @@ -346,7 +318,6 @@ weak_alias (__re_search_2, re_search_2) #endif static regoff_t -internal_function re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, regoff_t range, struct re_registers *regs, @@ -395,7 +366,6 @@ re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, otherwise the position of the match is returned. */ static regoff_t -internal_function re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, bool ret_len) @@ -485,7 +455,6 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, } static unsigned -internal_function re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated) { @@ -611,7 +580,7 @@ re_exec (const char *s) (0 <= LAST_START && LAST_START <= LENGTH) */ static reg_errcode_t -__attribute_warn_unused_result__ internal_function +__attribute_warn_unused_result__ re_search_internal (const regex_t *preg, const char *string, Idx length, Idx start, Idx last_start, Idx stop, size_t nmatch, regmatch_t pmatch[], int eflags) @@ -945,7 +914,7 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ prune_impossible_nodes (re_match_context_t *mctx) { const re_dfa_t *const dfa = mctx->dfa; @@ -1041,7 +1010,7 @@ prune_impossible_nodes (re_match_context_t *mctx) since initial states may have constraints like "\<", "^", etc.. */ static inline re_dfastate_t * -__attribute__ ((always_inline)) internal_function +__attribute__ ((always_inline)) acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, Idx idx) { @@ -1083,7 +1052,7 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, index of the buffer. */ static Idx -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ check_matching (re_match_context_t *mctx, bool fl_longest_match, Idx *p_match_first) { @@ -1216,7 +1185,6 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, /* Check NODE match the current context. */ static bool -internal_function check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context) { re_token_type_t type = dfa->nodes[node].type; @@ -1235,7 +1203,6 @@ check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context) match the context, return the node. */ static Idx -internal_function check_halt_state_context (const re_match_context_t *mctx, const re_dfastate_t *state, Idx idx) { @@ -1257,7 +1224,6 @@ check_halt_state_context (const re_match_context_t *mctx, return -1 in case of errors. */ static Idx -internal_function proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, Idx *pidx, Idx node, re_node_set *eps_via_nodes, struct re_fail_stack_t *fs) @@ -1359,7 +1325,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) { @@ -1368,8 +1334,8 @@ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, if (fs->num == fs->alloc) { struct re_fail_stack_ent_t *new_array; - new_array = realloc (fs->stack, (sizeof (struct re_fail_stack_ent_t) - * fs->alloc * 2)); + new_array = re_realloc (fs->stack, struct re_fail_stack_ent_t, + fs->alloc * 2); if (new_array == NULL) return REG_ESPACE; fs->alloc *= 2; @@ -1386,7 +1352,6 @@ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, } static Idx -internal_function pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) { @@ -1406,7 +1371,7 @@ pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, bool fl_backtrack) { @@ -1513,7 +1478,6 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, } static reg_errcode_t -internal_function free_fail_stack_return (struct re_fail_stack_t *fs) { if (fs) @@ -1530,7 +1494,6 @@ free_fail_stack_return (struct re_fail_stack_t *fs) } static void -internal_function update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch) { @@ -1602,7 +1565,6 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, ((state) != NULL && re_node_set_contains (&(state)->nodes, node)) static reg_errcode_t -internal_function sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx) { reg_errcode_t err; @@ -1660,7 +1622,7 @@ sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx) } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *cur_dest) { @@ -1722,7 +1684,6 @@ build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, /* Helper functions. */ static reg_errcode_t -internal_function clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx) { Idx top = mctx->state_log_top; @@ -1748,7 +1709,6 @@ clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx) } static reg_errcode_t -internal_function merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst, re_dfastate_t **src, Idx num) { @@ -1775,7 +1735,6 @@ merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst, } static reg_errcode_t -internal_function update_cur_sifted_state (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *dest_nodes) @@ -1823,7 +1782,7 @@ update_cur_sifted_state (const re_match_context_t *mctx, } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates) { @@ -1852,7 +1811,6 @@ add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes, } static reg_errcode_t -internal_function sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes, const re_node_set *candidates) { @@ -1901,7 +1859,6 @@ sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes, } static bool -internal_function check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits, Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx) { @@ -1937,7 +1894,6 @@ check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits, } static int -internal_function check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, Idx subexp_idx, Idx from_node, Idx bkref_idx) { @@ -2019,7 +1975,6 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, } static int -internal_function check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit, Idx subexp_idx, Idx from_node, Idx str_idx, Idx bkref_idx) @@ -2049,7 +2004,6 @@ check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit, which are against limitations from DEST_NODES. */ static reg_errcode_t -internal_function check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, struct re_backref_cache_entry *bkref_ents, Idx str_idx) @@ -2137,7 +2091,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, const re_node_set *candidates) { @@ -2237,7 +2191,6 @@ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, #ifdef RE_ENABLE_I18N static int -internal_function sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx node_idx, Idx str_idx, Idx max_str_idx) { @@ -2267,7 +2220,7 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, update the destination of STATE_LOG. */ static re_dfastate_t * -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ transit_state (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *state) { @@ -2325,7 +2278,6 @@ transit_state (reg_errcode_t *err, re_match_context_t *mctx, /* Update the state_log if we need */ static re_dfastate_t * -internal_function merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *next_state) { @@ -2404,7 +2356,6 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, multi-byte match, then look in the log for a state from which to restart matching. */ static re_dfastate_t * -internal_function find_recover_state (reg_errcode_t *err, re_match_context_t *mctx) { re_dfastate_t *cur_state; @@ -2435,7 +2386,6 @@ find_recover_state (reg_errcode_t *err, re_match_context_t *mctx) corresponding back references. */ static reg_errcode_t -internal_function check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, Idx str_idx) { @@ -2508,7 +2458,6 @@ transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx, #ifdef RE_ENABLE_I18N static reg_errcode_t -internal_function transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate) { const re_dfa_t *const dfa = mctx->dfa; @@ -2579,7 +2528,6 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate) #endif /* RE_ENABLE_I18N */ static reg_errcode_t -internal_function transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) { const re_dfa_t *const dfa = mctx->dfa; @@ -2693,7 +2641,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) delay these checking for prune_impossible_nodes(). */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) { const re_dfa_t *const dfa = mctx->dfa; @@ -2843,7 +2791,6 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) and SUB_LAST. */ static reg_errcode_t -internal_function get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str) { @@ -2872,7 +2819,6 @@ get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, E.g. RE: (a){2} */ static Idx -internal_function find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, Idx subexp_idx, int type) { @@ -2894,7 +2840,7 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, Idx top_str, Idx last_node, Idx last_str, int type) { @@ -3059,7 +3005,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, Can't we unify them? */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, re_node_set *cur_nodes, re_node_set *next_nodes) { @@ -3140,7 +3086,6 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, */ static reg_errcode_t -internal_function check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, Idx ex_subexp, int type) { @@ -3193,7 +3138,7 @@ check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, problematic append it to DST_NODES. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes, Idx target, Idx ex_subexp, int type) { @@ -3238,7 +3183,7 @@ check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes, in MCTX->BKREF_ENTS. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Idx cur_str, Idx subexp_num, int type) { @@ -3327,7 +3272,6 @@ expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Return true if successful. */ static bool -internal_function build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) { reg_errcode_t err; @@ -3375,7 +3319,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) if (BE (ndests <= 0, 0)) { if (dests_node_malloced) - free (dests_alloc); + re_free (dests_alloc); /* Return false in case of an error, true otherwise. */ if (ndests == 0) { @@ -3405,18 +3349,17 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) alloca (ndests * 3 * sizeof (re_dfastate_t *)); else { - dest_states = (re_dfastate_t **) - malloc (ndests * 3 * sizeof (re_dfastate_t *)); + dest_states = re_malloc (re_dfastate_t *, ndests * 3); if (BE (dest_states == NULL, 0)) { out_free: if (dest_states_malloced) - free (dest_states); + re_free (dest_states); re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); if (dests_node_malloced) - free (dests_alloc); + re_free (dests_alloc); return false; } dest_states_malloced = true; @@ -3547,14 +3490,14 @@ out_free: } if (dest_states_malloced) - free (dest_states); + re_free (dest_states); re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); if (dests_node_malloced) - free (dests_alloc); + re_free (dests_alloc); return true; } @@ -3565,7 +3508,6 @@ out_free: to DEST_CH[i]. This function return the number of destinations. */ static Idx -internal_function group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *dests_node, bitset_t *dests_ch) { @@ -3762,7 +3704,6 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, # endif static int -internal_function check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, const re_string_t *input, Idx str_idx) { @@ -3992,7 +3933,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, # ifdef _LIBC static unsigned int -internal_function find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len) { uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); @@ -4056,7 +3996,6 @@ find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len) byte of the INPUT. */ static bool -internal_function check_node_accept (const re_match_context_t *mctx, const re_token_t *node, Idx idx) { @@ -4078,7 +4017,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node, case OP_UTF8_PERIOD: if (ch >= ASCII_CHARS) return false; - /* FALLTHROUGH */ + FALLTHROUGH; #endif case OP_PERIOD: if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE)) @@ -4106,7 +4045,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node, /* Extend the buffers, if the buffers have run out. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ extend_buffers (re_match_context_t *mctx, int min_len) { reg_errcode_t ret; @@ -4172,7 +4111,7 @@ extend_buffers (re_match_context_t *mctx, int min_len) /* Initialize MCTX. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n) { mctx->eflags = eflags; @@ -4207,7 +4146,6 @@ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n) of the input, or changes the input string. */ static void -internal_function match_ctx_clean (re_match_context_t *mctx) { Idx st_idx; @@ -4227,7 +4165,7 @@ match_ctx_clean (re_match_context_t *mctx) re_free (top->path->array); re_free (top->path); } - free (top); + re_free (top); } mctx->nsub_tops = 0; @@ -4237,7 +4175,6 @@ match_ctx_clean (re_match_context_t *mctx) /* Free all the memory associated with MCTX. */ static void -internal_function match_ctx_free (re_match_context_t *mctx) { /* First, free all the memory associated with MCTX->SUB_TOPS. */ @@ -4252,7 +4189,7 @@ match_ctx_free (re_match_context_t *mctx) */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, Idx to) { @@ -4301,7 +4238,6 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, found. Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX. */ static Idx -internal_function search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) { Idx left, right, mid, last; @@ -4324,7 +4260,7 @@ search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) at STR_IDX. */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx) { #ifdef DEBUG @@ -4354,7 +4290,6 @@ match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx) at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP. */ static re_sub_match_last_t * -internal_function match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx) { re_sub_match_last_t *new_entry; @@ -4381,7 +4316,6 @@ match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx) } static void -internal_function sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, re_dfastate_t **limited_sts, Idx last_node, Idx last_str_idx) { diff --git a/lib/sched.in.h b/lib/sched.in.h index aa96aed..34e9655 100644 --- a/lib/sched.in.h +++ b/lib/sched.in.h @@ -1,5 +1,5 @@ /* A GNU-like <sched.h>. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_SCHED_H @@ -34,15 +34,18 @@ /* Get pid_t. This is needed on glibc 2.11 (see - glibc bug <http://sourceware.org/bugzilla/show_bug.cgi?id=13198>) + glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=13198>) and Mac OS X 10.5. */ #include <sys/types.h> #ifdef __KLIBC__ - -/* On OS/2 kLIBC, struct sched_param is in spawn.h */ +/* On OS/2 kLIBC, struct sched_param is in spawn.h. */ # include <spawn.h> +#endif +#ifdef __VMS +/* On OpenVMS, struct sched_param is in <pthread.h>. */ +# include <pthread.h> #endif #if !@HAVE_STRUCT_SCHED_PARAM@ diff --git a/lib/secure_getenv.c b/lib/secure_getenv.c index df53dea..099da63 100644 --- a/lib/secure_getenv.c +++ b/lib/secure_getenv.c @@ -1,6 +1,6 @@ /* Look up an environment variable, returning NULL in insecure situations. - Copyright 2013-2017 Free Software Foundation, Inc. + Copyright 2013-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/select.c b/lib/select.c index e37484d..92ca725 100644 --- a/lib/select.c +++ b/lib/select.c @@ -1,7 +1,7 @@ /* Emulation for select(2) Contributed by Paolo Bonzini. - Copyright 2008-2017 Free Software Foundation, Inc. + Copyright 2008-2018 Free Software Foundation, Inc. This file is part of gnulib. @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> #include <alloca.h> @@ -39,7 +39,11 @@ /* Get the overridden 'struct timeval'. */ #include <sys/time.h> -#include "msvc-nothrow.h" +#if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +#else +# include <io.h> +#endif #undef select @@ -1,6 +1,6 @@ /* send.c --- wrappers for Windows send function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/setsockopt.c b/lib/setsockopt.c index 157e4b6..1a7b583 100644 --- a/lib/setsockopt.c +++ b/lib/setsockopt.c @@ -1,6 +1,6 @@ /* setsockopt.c --- wrappers for Windows setsockopt function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ @@ -1,7 +1,7 @@ /* sha1.c - Functions to compute SHA1 message digest of files or memory blocks according to the NIST specification FIPS-180-1. - Copyright (C) 2000-2001, 2003-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2003-2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Scott G. Miller Credits: @@ -233,7 +233,8 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ + /* The regions in the following copy operation cannot overlap, + because ctx->buflen < 64 ≤ (left_over + add) & ~63. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~63], ctx->buflen); @@ -275,6 +276,8 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) { sha1_process_block (ctx->buffer, 64, ctx); left_over -= 64; + /* The regions in the following copy operation cannot overlap, + because left_over ≤ 64. */ memcpy (ctx->buffer, &ctx->buffer[16], left_over); } ctx->buflen = left_over; @@ -431,3 +434,10 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) } } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for SHA1 sum library functions. - Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2017 Free Software + Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef SHA1_H # define SHA1_H 1 @@ -46,8 +46,8 @@ struct sha1_ctx uint32_t E; uint32_t total[2]; - uint32_t buflen; - uint32_t buffer[32]; + uint32_t buflen; /* ≥ 0, ≤ 128 */ + uint32_t buffer[32]; /* 128 bytes; the first buflen bytes are in use */ }; /* Initialize structure containing state of computation. */ @@ -98,3 +98,10 @@ extern int sha1_stream (FILE *stream, void *resblock); # endif #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/sha256.c b/lib/sha256.c index 03d3899..85405b2 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -1,7 +1,7 @@ /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or memory blocks according to the NIST specification FIPS-180-2. - Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David Madore, considerably copypasting from Scott G. Miller's sha1.c @@ -366,7 +366,8 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ + /* The regions in the following copy operation cannot overlap, + because ctx->buflen < 64 ≤ (left_over + add) & ~63. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~63], ctx->buflen); @@ -408,6 +409,8 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) { sha256_process_block (ctx->buffer, 64, ctx); left_over -= 64; + /* The regions in the following copy operation cannot overlap, + because left_over ≤ 64. */ memcpy (ctx->buffer, &ctx->buffer[16], left_over); } ctx->buflen = left_over; @@ -574,3 +577,10 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) } } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/sha256.h b/lib/sha256.h index ffb91fa..e344986 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for SHA256 and SHA224 sum library functions. - Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef SHA256_H # define SHA256_H 1 @@ -44,8 +44,8 @@ struct sha256_ctx uint32_t state[8]; uint32_t total[2]; - size_t buflen; - uint32_t buffer[32]; + size_t buflen; /* ≥ 0, ≤ 128 */ + uint32_t buffer[32]; /* 128 bytes; the first buflen bytes are in use */ }; /* Initialize structure containing state of computation. */ @@ -101,3 +101,10 @@ extern int sha224_stream (FILE *stream, void *resblock); # endif #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/sha512.c b/lib/sha512.c index 6876bfd..8a6dd4e 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -1,7 +1,7 @@ /* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or memory blocks according to the NIST specification FIPS-180-2. - Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David Madore, considerably copypasting from Scott G. Miller's sha1.c @@ -374,7 +374,8 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx); ctx->buflen &= 127; - /* The regions in the following copy operation cannot overlap. */ + /* The regions in the following copy operation cannot overlap, + because ctx->buflen < 128 ≤ (left_over + add) & ~127. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~127], ctx->buflen); @@ -416,6 +417,8 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) { sha512_process_block (ctx->buffer, 128, ctx); left_over -= 128; + /* The regions in the following copy operation cannot overlap, + because left_over ≤ 128. */ memcpy (ctx->buffer, &ctx->buffer[16], left_over); } ctx->buflen = left_over; @@ -626,3 +629,10 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx) } } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/sha512.h b/lib/sha512.h index 121e6c3..6a0aadb 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -1,6 +1,6 @@ /* Declarations of functions and data types used for SHA512 and SHA384 sum library functions. - Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef SHA512_H # define SHA512_H 1 @@ -44,8 +44,8 @@ struct sha512_ctx u64 state[8]; u64 total[2]; - size_t buflen; - u64 buffer[32]; + size_t buflen; /* ≥ 0, ≤ 256 */ + u64 buffer[32]; /* 256 bytes; the first buflen bytes are in use */ }; /* Initialize structure containing state of computation. */ @@ -104,3 +104,10 @@ extern int sha384_stream (FILE *stream, void *resblock); # endif #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/lib/sig-handler.h b/lib/sig-handler.h index b6fd841..ce28a2a 100644 --- a/lib/sig-handler.h +++ b/lib/sig-handler.h @@ -1,6 +1,6 @@ /* Convenience declarations when working with <signal.h>. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_SIG_HANDLER_H #define _GL_SIG_HANDLER_H diff --git a/lib/sigaction.c b/lib/sigaction.c index 380f9fc..da46b1c 100644 --- a/lib/sigaction.c +++ b/lib/sigaction.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Eric Blake <ebb9@byu.net>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/signal.in.h b/lib/signal.in.h index 1ffba37..7d4927b 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -1,6 +1,6 @@ /* A GNU-like <signal.h>. - Copyright (C) 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2006-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -137,7 +137,7 @@ _GL_FUNCDECL_RPL (pthread_sigmask, int, _GL_CXXALIAS_RPL (pthread_sigmask, int, (int how, const sigset_t *new_mask, sigset_t *old_mask)); # else -# if !@HAVE_PTHREAD_SIGMASK@ +# if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask) _GL_FUNCDECL_SYS (pthread_sigmask, int, (int how, const sigset_t *new_mask, sigset_t *old_mask)); # endif @@ -200,7 +200,7 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && (defined __i386__ || defined __x86_64__)) diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c index ec4cfeb..0a8cd53 100644 --- a/lib/sigprocmask.c +++ b/lib/sigprocmask.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2006-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/size_max.h b/lib/size_max.h index f0c00b4..00500b5 100644 --- a/lib/size_max.h +++ b/lib/size_max.h @@ -1,5 +1,5 @@ /* size_max.h -- declare SIZE_MAX through system headers - Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef GNULIB_SIZE_MAX_H #define GNULIB_SIZE_MAX_H diff --git a/lib/snprintf.c b/lib/snprintf.c index d66302f..8a9971b 100644 --- a/lib/snprintf.c +++ b/lib/snprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 2004, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2018 Free Software Foundation, Inc. Written by Simon Josefsson and Paul Eggert. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/socket.c b/lib/socket.c index 47aa557..84f4d94 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -1,6 +1,6 @@ /* socket.c --- wrappers for Windows socket function - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ diff --git a/lib/sockets.c b/lib/sockets.c index 9333ee4..eec1ec8 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -1,6 +1,6 @@ /* sockets.c --- wrappers for Windows socket functions - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson */ @@ -28,7 +28,11 @@ # include <sys/socket.h> # include "fd-hook.h" -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif /* Get set_winsock_errno, FD_TO_SOCKET etc. */ # include "w32sock.h" diff --git a/lib/sockets.h b/lib/sockets.h index 8392e57..5a83332 100644 --- a/lib/sockets.h +++ b/lib/sockets.h @@ -1,6 +1,6 @@ /* sockets.h - wrappers for Windows socket functions - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,12 +13,12 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson */ #ifndef SOCKETS_H -# define SOCKETS_H 1 +#define SOCKETS_H 1 #define SOCKETS_1_0 0x0001 #define SOCKETS_1_1 0x0101 @@ -43,9 +43,13 @@ int gl_sockets_cleanup (void) other library that only accepts sockets. */ #ifdef WINDOWS_SOCKETS -#include <sys/socket.h> +# include <sys/socket.h> -#include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif static inline SOCKET gl_fd_to_handle (int fd) @@ -55,7 +59,7 @@ gl_fd_to_handle (int fd) #else -#define gl_fd_to_handle(x) (x) +# define gl_fd_to_handle(x) (x) #endif /* WINDOWS_SOCKETS */ diff --git a/lib/spawn-pipe.c b/lib/spawn-pipe.c index 7e8f241..8a5956d 100644 --- a/lib/spawn-pipe.c +++ b/lib/spawn-pipe.c @@ -1,5 +1,5 @@ /* Creation of subprocesses, communicating via pipes. - Copyright (C) 2001-2004, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2018 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -13,9 +13,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ +/* Tell clang not to warn about the 'child' variable, below. */ +#if defined __clang__ +# pragma clang diagnostic ignored "-Wconditional-uninitialized" +#endif + #include <config.h> /* Specification. */ diff --git a/lib/spawn-pipe.h b/lib/spawn-pipe.h index 6c268fb..755356c 100644 --- a/lib/spawn-pipe.h +++ b/lib/spawn-pipe.h @@ -1,5 +1,5 @@ /* Creation of subprocesses, communicating via pipes. - Copyright (C) 2001-2003, 2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _SPAWN_PIPE_H #define _SPAWN_PIPE_H diff --git a/lib/spawn.c b/lib/spawn.c index 6899fd0..f15e0cd 100644 --- a/lib/spawn.c +++ b/lib/spawn.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawn.in.h b/lib/spawn.in.h index b4b9197..b0dfcb5 100644 --- a/lib/spawn.in.h +++ b/lib/spawn.in.h @@ -1,5 +1,5 @@ /* Definitions for POSIX spawn interface. - Copyright (C) 2000, 2003-2004, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2000, 2003-2004, 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_SPAWN_H diff --git a/lib/spawn_faction_addclose.c b/lib/spawn_faction_addclose.c index 529a7c0..93827dc 100644 --- a/lib/spawn_faction_addclose.c +++ b/lib/spawn_faction_addclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawn_faction_adddup2.c b/lib/spawn_faction_adddup2.c index 440f215..86ae0af 100644 --- a/lib/spawn_faction_adddup2.c +++ b/lib/spawn_faction_adddup2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawn_faction_addopen.c b/lib/spawn_faction_addopen.c index cabadf7..5b62142 100644 --- a/lib/spawn_faction_addopen.c +++ b/lib/spawn_faction_addopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawn_faction_destroy.c b/lib/spawn_faction_destroy.c index f93c4ec..1b20ef6 100644 --- a/lib/spawn_faction_destroy.c +++ b/lib/spawn_faction_destroy.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawn_faction_init.c b/lib/spawn_faction_init.c index 8de0325..6bd628c 100644 --- a/lib/spawn_faction_init.c +++ b/lib/spawn_faction_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawn_int.h b/lib/spawn_int.h index 3df5f11..909122e 100644 --- a/lib/spawn_int.h +++ b/lib/spawn_int.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2008-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <sys/types.h> diff --git a/lib/spawnattr_destroy.c b/lib/spawnattr_destroy.c index f408838..57cc89b 100644 --- a/lib/spawnattr_destroy.c +++ b/lib/spawnattr_destroy.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawnattr_init.c b/lib/spawnattr_init.c index 0cbf61c..954c377 100644 --- a/lib/spawnattr_init.c +++ b/lib/spawnattr_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawnattr_setflags.c b/lib/spawnattr_setflags.c index 4c1c017..c4e06c2 100644 --- a/lib/spawnattr_setflags.c +++ b/lib/spawnattr_setflags.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2004, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2004, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawnattr_setsigmask.c b/lib/spawnattr_setsigmask.c index ad10707..e9d7526 100644 --- a/lib/spawnattr_setsigmask.c +++ b/lib/spawnattr_setsigmask.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawni.c b/lib/spawni.c index 811d309..ab77dfe 100644 --- a/lib/spawni.c +++ b/lib/spawni.c @@ -1,5 +1,5 @@ /* Guts of POSIX spawn interface. Generic POSIX.1 version. - Copyright (C) 2000-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/spawnp.c b/lib/spawnp.c index b0d8bbe..dcb4d29 100644 --- a/lib/spawnp.c +++ b/lib/spawnp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2009-2017 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/stat-time.h b/lib/stat-time.h index 9402b3f..104f537 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -1,6 +1,6 @@ /* stat-related time functions. - Copyright (C) 2005, 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,13 +13,17 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ #ifndef STAT_TIME_H #define STAT_TIME_H 1 +#include "intprops.h" + +#include <errno.h> +#include <stddef.h> #include <sys/stat.h> #include <time.h> @@ -31,6 +35,10 @@ _GL_INLINE_HEADER_BEGIN # define _GL_STAT_TIME_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST, @@ -39,8 +47,8 @@ _GL_INLINE_HEADER_BEGIN time respectively. These macros are private to stat-time.h. */ -#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC -# ifdef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC +#if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC +# if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) # else # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) @@ -94,15 +102,13 @@ get_stat_mtime_ns (struct stat const *st) /* Return the nanosecond component of *ST's birth time. */ _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE -get_stat_birthtime_ns (struct stat const *st) +get_stat_birthtime_ns (struct stat const *st _GL_UNUSED) { # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC return STAT_TIMESPEC (st, st_birthtim).tv_nsec; # elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC return STAT_TIMESPEC_NS (st, st_birthtim); # else - /* Avoid a "parameter unused" warning. */ - (void) st; return 0; # endif } @@ -152,7 +158,7 @@ get_stat_mtime (struct stat const *st) /* Return *ST's birth time, if available; otherwise return a value with tv_sec and tv_nsec both equal to -1. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE -get_stat_birthtime (struct stat const *st) +get_stat_birthtime (struct stat const *st _GL_UNUSED) { struct timespec t; @@ -165,15 +171,17 @@ get_stat_birthtime (struct stat const *st) #elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Native Windows platforms (but not Cygwin) put the "file creation time" in st_ctime (!). See - <http://msdn2.microsoft.com/de-de/library/14h5k7ff(VS.80).aspx>. */ + <https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */ +# if _GL_WINDOWS_STAT_TIMESPEC + t = st->st_ctim; +# else t.tv_sec = st->st_ctime; t.tv_nsec = 0; +# endif #else /* Birth time is not supported. */ t.tv_sec = -1; t.tv_nsec = -1; - /* Avoid a "parameter unused" warning. */ - (void) st; #endif #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ @@ -194,6 +202,51 @@ get_stat_birthtime (struct stat const *st) return t; } +/* If a stat-like function returned RESULT, normalize the timestamps + in *ST, in case this platform suffers from the Solaris 11 bug where + tv_nsec might be negative. Return the adjusted RESULT, setting + errno to EOVERFLOW if normalization overflowed. This function + is intended to be private to this .h file. */ +_GL_STAT_TIME_INLINE int +stat_time_normalize (int result, struct stat *st _GL_UNUSED) +{ +#if defined __sun && defined STAT_TIMESPEC + if (result == 0) + { + long int timespec_resolution = 1000000000; + short int const ts_off[] = { offsetof (struct stat, st_atim), + offsetof (struct stat, st_mtim), + offsetof (struct stat, st_ctim) }; + int i; + for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) + { + struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]); + long int q = ts->tv_nsec / timespec_resolution; + long int r = ts->tv_nsec % timespec_resolution; + if (r < 0) + { + r += timespec_resolution; + q--; + } + ts->tv_nsec = r; + /* Overflow is possible, as Solaris 11 stat can yield + tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. + INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ + if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec)) + { + errno = EOVERFLOW; + return -1; + } + } + } +#endif + return result; +} + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif diff --git a/lib/stat-w32.c b/lib/stat-w32.c new file mode 100644 index 0000000..5d76a46 --- /dev/null +++ b/lib/stat-w32.c @@ -0,0 +1,421 @@ +/* Core of implementation of fstat and stat for native Windows. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible. */ + +#include <config.h> + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +/* Ensure that <windows.h> defines FILE_ID_INFO. */ +#undef _WIN32_WINNT +#define _WIN32_WINNT _WIN32_WINNT_WIN8 + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <limits.h> +#include <string.h> +#include <unistd.h> +#include <windows.h> + +/* Specification. */ +#include "stat-w32.h" + +#include "pathmax.h" +#include "verify.h" + +#if _GL_WINDOWS_STAT_INODES == 2 +/* GetFileInformationByHandleEx was introduced only in Windows Vista. */ +typedef DWORD (WINAPI * GetFileInformationByHandleExFuncType) (HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS fiClass, + LPVOID lpBuffer, + DWORD dwBufferSize); +static GetFileInformationByHandleExFuncType GetFileInformationByHandleExFunc = NULL; +#endif +/* GetFinalPathNameByHandle was introduced only in Windows Vista. */ +typedef DWORD (WINAPI * GetFinalPathNameByHandleFuncType) (HANDLE hFile, + LPTSTR lpFilePath, + DWORD lenFilePath, + DWORD dwFlags); +static GetFinalPathNameByHandleFuncType GetFinalPathNameByHandleFunc = NULL; +static BOOL initialized = FALSE; + +static void +initialize (void) +{ + HMODULE kernel32 = LoadLibrary ("kernel32.dll"); + if (kernel32 != NULL) + { +#if _GL_WINDOWS_STAT_INODES == 2 + GetFileInformationByHandleExFunc = + (GetFileInformationByHandleExFuncType) GetProcAddress (kernel32, "GetFileInformationByHandleEx"); +#endif + GetFinalPathNameByHandleFunc = + (GetFinalPathNameByHandleFuncType) GetProcAddress (kernel32, "GetFinalPathNameByHandleA"); + } + initialized = TRUE; +} + +/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ +#if _GL_WINDOWS_STAT_TIMESPEC +struct timespec +_gl_convert_FILETIME_to_timespec (const FILETIME *ft) +{ + struct timespec result; + /* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ + unsigned long long since_1601 = + ((unsigned long long) ft->dwHighDateTime << 32) + | (unsigned long long) ft->dwLowDateTime; + if (since_1601 == 0) + { + result.tv_sec = 0; + result.tv_nsec = 0; + } + else + { + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 + leap years, in total 134774 days. */ + unsigned long long since_1970 = + since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; + result.tv_sec = since_1970 / (unsigned long long) 10000000; + result.tv_nsec = (unsigned long) (since_1970 % (unsigned long long) 10000000) * 100; + } + return result; +} +#else +time_t +_gl_convert_FILETIME_to_POSIX (const FILETIME *ft) +{ + /* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ + unsigned long long since_1601 = + ((unsigned long long) ft->dwHighDateTime << 32) + | (unsigned long long) ft->dwLowDateTime; + if (since_1601 == 0) + return 0; + else + { + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 + leap years, in total 134774 days. */ + unsigned long long since_1970 = + since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; + return since_1970 / (unsigned long long) 10000000; + } +} +#endif + +/* Fill *BUF with information about the file designated by H. + PATH is the file name, if known, otherwise NULL. + Return 0 if successful, or -1 with errno set upon failure. */ +int +_gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf) +{ + /* GetFileType + <https://msdn.microsoft.com/en-us/library/aa364960.aspx> */ + DWORD type = GetFileType (h); + if (type == FILE_TYPE_DISK) + { + if (!initialized) + initialize (); + + /* st_mode can be determined through + GetFileAttributesEx + <https://msdn.microsoft.com/en-us/library/aa364946.aspx> + <https://msdn.microsoft.com/en-us/library/aa365739.aspx> + or through + GetFileInformationByHandle + <https://msdn.microsoft.com/en-us/library/aa364952.aspx> + <https://msdn.microsoft.com/en-us/library/aa363788.aspx> + or through + GetFileInformationByHandleEx with argument FileBasicInfo + <https://msdn.microsoft.com/en-us/library/aa364953.aspx> + <https://msdn.microsoft.com/en-us/library/aa364217.aspx> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + BY_HANDLE_FILE_INFORMATION info; + if (! GetFileInformationByHandle (h, &info)) + goto failed; + + /* Test for error conditions before starting to fill *buf. */ + if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) + { + errno = EOVERFLOW; + return -1; + } + +#if _GL_WINDOWS_STAT_INODES + /* st_ino can be determined through + GetFileInformationByHandle + <https://msdn.microsoft.com/en-us/library/aa364952.aspx> + <https://msdn.microsoft.com/en-us/library/aa363788.aspx> + as 64 bits, or through + GetFileInformationByHandleEx with argument FileIdInfo + <https://msdn.microsoft.com/en-us/library/aa364953.aspx> + <https://msdn.microsoft.com/en-us/library/hh802691.aspx> + as 128 bits. + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_WIN8 or higher. */ + /* Experiments show that GetFileInformationByHandleEx does not provide + much more information than GetFileInformationByHandle: + * The dwVolumeSerialNumber from GetFileInformationByHandle is equal + to the low 32 bits of the 64-bit VolumeSerialNumber from + GetFileInformationByHandleEx, and is apparently sufficient for + identifying the device. + * The nFileIndex from GetFileInformationByHandle is equal to the low + 64 bits of the 128-bit FileId from GetFileInformationByHandleEx, + and the high 64 bits of this 128-bit FileId are zero. + * On a FAT file system, GetFileInformationByHandleEx fails with error + ERROR_INVALID_PARAMETER, whereas GetFileInformationByHandle + succeeds. + * On a CIFS/SMB file system, GetFileInformationByHandleEx fails with + error ERROR_INVALID_LEVEL, whereas GetFileInformationByHandle + succeeds. */ +# if _GL_WINDOWS_STAT_INODES == 2 + if (GetFileInformationByHandleExFunc != NULL) + { + FILE_ID_INFO id; + if (GetFileInformationByHandleExFunc (h, FileIdInfo, &id, sizeof (id))) + { + buf->st_dev = id.VolumeSerialNumber; + verify (sizeof (ino_t) == sizeof (id.FileId)); + memcpy (&buf->st_ino, &id.FileId, sizeof (ino_t)); + goto ino_done; + } + else + { + switch (GetLastError ()) + { + case ERROR_INVALID_PARAMETER: /* older Windows version, or FAT */ + case ERROR_INVALID_LEVEL: /* CIFS/SMB file system */ + goto fallback; + default: + goto failed; + } + } + } + fallback: ; + /* Fallback for older Windows versions. */ + buf->st_dev = info.dwVolumeSerialNumber; + buf->st_ino._gl_ino[0] = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; + buf->st_ino._gl_ino[1] = 0; + ino_done: ; +# else /* _GL_WINDOWS_STAT_INODES == 1 */ + buf->st_dev = info.dwVolumeSerialNumber; + buf->st_ino = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; +# endif +#else + /* st_ino is not wide enough for identifying a file on a device. + Without st_ino, st_dev is pointless. */ + buf->st_dev = 0; + buf->st_ino = 0; +#endif + + /* st_mode. */ + unsigned int mode = + /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ + ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) + | S_IREAD_UGO + | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + /* Determine whether the file is executable by looking at the file + name suffix. + If the file name is already known, use it. Otherwise, for + non-empty files, it can be determined through + GetFinalPathNameByHandle + <https://msdn.microsoft.com/en-us/library/aa364962.aspx> + or through + GetFileInformationByHandleEx with argument FileNameInfo + <https://msdn.microsoft.com/en-us/library/aa364953.aspx> + <https://msdn.microsoft.com/en-us/library/aa364388.aspx> + Both require -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) + { + char fpath[PATH_MAX]; + if (path != NULL + || (GetFinalPathNameByHandleFunc != NULL + && GetFinalPathNameByHandleFunc (h, fpath, sizeof (fpath), VOLUME_NAME_NONE) + < sizeof (fpath) + && (path = fpath, 1))) + { + const char *last_dot = NULL; + const char *p; + for (p = path; *p != '\0'; p++) + if (*p == '.') + last_dot = p; + if (last_dot != NULL) + { + const char *suffix = last_dot + 1; + if (_stricmp (suffix, "exe") == 0 + || _stricmp (suffix, "bat") == 0 + || _stricmp (suffix, "cmd") == 0 + || _stricmp (suffix, "com") == 0) + mode |= S_IEXEC_UGO; + } + } + else + /* Cannot determine file name. Pretend that it is executable. */ + mode |= S_IEXEC_UGO; + } + } + buf->st_mode = mode; + + /* st_nlink can be determined through + GetFileInformationByHandle + <https://msdn.microsoft.com/en-us/library/aa364952.aspx> + <https://msdn.microsoft.com/en-us/library/aa363788.aspx> + or through + GetFileInformationByHandleEx with argument FileStandardInfo + <https://msdn.microsoft.com/en-us/library/aa364953.aspx> + <https://msdn.microsoft.com/en-us/library/aa364401.aspx> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + buf->st_nlink = (info.nNumberOfLinks > SHRT_MAX ? SHRT_MAX : info.nNumberOfLinks); + + /* There's no easy way to map the Windows SID concept to an integer. */ + buf->st_uid = 0; + buf->st_gid = 0; + + /* st_rdev is irrelevant for normal files and directories. */ + buf->st_rdev = 0; + + /* st_size can be determined through + GetFileSizeEx + <https://msdn.microsoft.com/en-us/library/aa364957.aspx> + or through + GetFileAttributesEx + <https://msdn.microsoft.com/en-us/library/aa364946.aspx> + <https://msdn.microsoft.com/en-us/library/aa365739.aspx> + or through + GetFileInformationByHandle + <https://msdn.microsoft.com/en-us/library/aa364952.aspx> + <https://msdn.microsoft.com/en-us/library/aa363788.aspx> + or through + GetFileInformationByHandleEx with argument FileStandardInfo + <https://msdn.microsoft.com/en-us/library/aa364953.aspx> + <https://msdn.microsoft.com/en-us/library/aa364401.aspx> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + if (sizeof (buf->st_size) <= 4) + /* Range check already done above. */ + buf->st_size = info.nFileSizeLow; + else + buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; + + /* st_atime, st_mtime, st_ctime can be determined through + GetFileTime + <https://msdn.microsoft.com/en-us/library/ms724320.aspx> + or through + GetFileAttributesEx + <https://msdn.microsoft.com/en-us/library/aa364946.aspx> + <https://msdn.microsoft.com/en-us/library/aa365739.aspx> + or through + GetFileInformationByHandle + <https://msdn.microsoft.com/en-us/library/aa364952.aspx> + <https://msdn.microsoft.com/en-us/library/aa363788.aspx> + or through + GetFileInformationByHandleEx with argument FileBasicInfo + <https://msdn.microsoft.com/en-us/library/aa364953.aspx> + <https://msdn.microsoft.com/en-us/library/aa364217.aspx> + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ +#if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); + buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); + buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); +#else + buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); + buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); + buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); +#endif + + return 0; + } + else if (type == FILE_TYPE_CHAR || type == FILE_TYPE_PIPE) + { + buf->st_dev = 0; +#if _GL_WINDOWS_STAT_INODES == 2 + buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; +#else + buf->st_ino = 0; +#endif + buf->st_mode = (type == FILE_TYPE_PIPE ? _S_IFIFO : _S_IFCHR); + buf->st_nlink = 1; + buf->st_uid = 0; + buf->st_gid = 0; + buf->st_rdev = 0; + if (type == FILE_TYPE_PIPE) + { + /* PeekNamedPipe + <https://msdn.microsoft.com/en-us/library/aa365779.aspx> */ + DWORD bytes_available; + if (PeekNamedPipe (h, NULL, 0, NULL, &bytes_available, NULL)) + buf->st_size = bytes_available; + else + buf->st_size = 0; + } + else + buf->st_size = 0; +#if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim.tv_sec = 0; buf->st_atim.tv_nsec = 0; + buf->st_mtim.tv_sec = 0; buf->st_mtim.tv_nsec = 0; + buf->st_ctim.tv_sec = 0; buf->st_ctim.tv_nsec = 0; +#else + buf->st_atime = 0; + buf->st_mtime = 0; + buf->st_ctime = 0; +#endif + return 0; + } + else + { + errno = ENOENT; + return -1; + } + + failed: + { + DWORD error = GetLastError (); + #if 0 + fprintf (stderr, "_gl_fstat_by_handle error 0x%x\n", (unsigned int) error); + #endif + switch (error) + { + case ERROR_ACCESS_DENIED: + case ERROR_SHARING_VIOLATION: + errno = EACCES; + break; + + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + + case ERROR_WRITE_FAULT: + case ERROR_READ_FAULT: + case ERROR_GEN_FAILURE: + errno = EIO; + break; + + default: + errno = EINVAL; + break; + } + return -1; + } +} + +#else + +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; + +#endif diff --git a/lib/stat-w32.h b/lib/stat-w32.h new file mode 100644 index 0000000..9a3ecc1 --- /dev/null +++ b/lib/stat-w32.h @@ -0,0 +1,37 @@ +/* Core of implementation of fstat and stat for native Windows. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _STAT_W32_H +#define _STAT_W32_H 1 + +/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ +#if _GL_WINDOWS_STAT_TIMESPEC +extern struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft); +#else +extern time_t _gl_convert_FILETIME_to_POSIX (const FILETIME *ft); +#endif + +/* Fill *BUF with information about the file designated by H. + PATH is the file name, if known, otherwise NULL. + Return 0 if successful, or -1 with errno set upon failure. */ +extern int _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf); + +/* Bitmasks for st_mode. */ +#define S_IREAD_UGO (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) +#define S_IWRITE_UGO (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) +#define S_IEXEC_UGO (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) + +#endif /* _STAT_W32_H */ @@ -1,5 +1,5 @@ /* Work around platform bugs in stat. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,9 +12,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ -/* written by Eric Blake */ +/* Written by Eric Blake and Bruno Haible. */ /* If the user's config.h happens to include <sys/stat.h>, let it include only the system's <sys/stat.h> here, so that orig_stat doesn't recurse to @@ -28,46 +28,67 @@ #undef __need_system_sys_stat_h #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# if _GL_WINDOWS_64_BIT_ST_SIZE -# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define stat _stati64 -# define REPLACE_FUNC_STAT_DIR 1 -# undef REPLACE_FUNC_STAT_FILE -# elif REPLACE_FUNC_STAT_FILE -/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a. - Bypass it. */ -# define stat _stat -# define REPLACE_FUNC_STAT_DIR 1 -# undef REPLACE_FUNC_STAT_FILE -# endif +# define WINDOWS_NATIVE #endif +#if !defined WINDOWS_NATIVE + static int orig_stat (const char *filename, struct stat *buf) { return stat (filename, buf); } +#endif + /* Specification. */ /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc eliminates this include because of the preliminary #include <sys/stat.h> above. */ #include "sys/stat.h" +#include "stat-time.h" + #include <errno.h> #include <limits.h> #include <stdbool.h> #include <string.h> -#include "dosname.h" +#include "filename.h" +#include "malloca.h" #include "verify.h" -#if REPLACE_FUNC_STAT_DIR -# include "pathmax.h" - /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also - have a constant PATH_MAX. */ -# ifndef PATH_MAX -# error "Please port this replacement to your platform" -# endif +#ifdef WINDOWS_NATIVE +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# include "stat-w32.h" +#endif + +#ifdef WINDOWS_NATIVE +/* Return TRUE if the given file name denotes an UNC root. */ +static BOOL +is_unc_root (const char *rname) +{ + /* Test whether it has the syntax '\\server\share'. */ + if (ISSLASH (rname[0]) && ISSLASH (rname[1])) + { + /* It starts with two slashes. Find the next slash. */ + const char *p = rname + 2; + const char *q = p; + while (*q != '\0' && !ISSLASH (*q)) + q++; + if (q > p && *q != '\0') + { + /* Found the next slash at q. */ + q++; + const char *r = q; + while (*r != '\0' && !ISSLASH (*r)) + r++; + if (r > q && *r == '\0') + return TRUE; + } + } + return FALSE; +} #endif /* Store information about NAME into ST. Work around bugs with @@ -77,62 +98,332 @@ orig_stat (const char *filename, struct stat *buf) correctly. */ int -rpl_stat (char const *name, struct stat *st) +rpl_stat (char const *name, struct stat *buf) { - int result = orig_stat (name, st); -#if REPLACE_FUNC_STAT_FILE - /* Solaris 9 mistakenly succeeds when given a non-directory with a - trailing slash. */ - if (result == 0 && !S_ISDIR (st->st_mode)) +#ifdef WINDOWS_NATIVE + /* Fill the fields ourselves, because the original stat function returns + values for st_atime, st_mtime, st_ctime that depend on the current time + zone. See + <https://lists.gnu.org/r/bug-gnulib/2017-04/msg00134.html> */ + /* XXX Should we convert to wchar_t* and prepend '\\?\', in order to work + around length limitations + <https://msdn.microsoft.com/en-us/library/aa365247.aspx> ? */ + + /* POSIX <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13> + specifies: "More than two leading <slash> characters shall be treated as + a single <slash> character." */ + if (ISSLASH (name[0]) && ISSLASH (name[1]) && ISSLASH (name[2])) + { + name += 2; + while (ISSLASH (name[1])) + name++; + } + + size_t len = strlen (name); + size_t drive_prefix_len = (HAS_DEVICE (name) ? 2 : 0); + + /* Remove trailing slashes (except the very first one, at position + drive_prefix_len), but remember their presence. */ + size_t rlen; + bool check_dir = false; + + rlen = len; + while (rlen > drive_prefix_len && ISSLASH (name[rlen-1])) { - size_t len = strlen (name); - if (ISSLASH (name[len - 1])) + check_dir = true; + if (rlen == drive_prefix_len + 1) + break; + rlen--; + } + + /* Handle '' and 'C:'. */ + if (!check_dir && rlen == drive_prefix_len) + { + errno = ENOENT; + return -1; + } + + /* Handle '\\'. */ + if (rlen == 1 && ISSLASH (name[0]) && len >= 2) + { + errno = ENOENT; + return -1; + } + + const char *rname; + char *malloca_rname; + if (rlen == len) + { + rname = name; + malloca_rname = NULL; + } + else + { + malloca_rname = malloca (rlen + 1); + if (malloca_rname == NULL) { - errno = ENOTDIR; + errno = ENOMEM; return -1; } + memcpy (malloca_rname, name, rlen); + malloca_rname[rlen] = '\0'; + rname = malloca_rname; } -#endif /* REPLACE_FUNC_STAT_FILE */ -#if REPLACE_FUNC_STAT_DIR - if (result == -1 && errno == ENOENT) + /* There are two ways to get at the requested information: + - by scanning the parent directory and examining the relevant + directory entry, + - by opening the file directly. + The first approach fails for root directories (e.g. 'C:\') and + UNC root directories (e.g. '\\server\share'). + The second approach fails for some system files (e.g. 'C:\pagefile.sys' + and 'C:\hiberfil.sys'): ERROR_SHARING_VIOLATION. + The second approach gives more information (in particular, correct + st_dev, st_ino, st_nlink fields). + So we use the second approach and, as a fallback except for root and + UNC root directories, also the first approach. */ + { + int ret; + { - /* Due to mingw's oddities, there are some directories (like - c:\) where stat() only succeeds with a trailing slash, and - other directories (like c:\windows) where stat() only - succeeds without a trailing slash. But we want the two to be - synonymous, since chdir() manages either style. Likewise, Mingw also - reports ENOENT for names longer than PATH_MAX, when we want - ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR. - Fortunately, mingw PATH_MAX is small enough for stack - allocation. */ - char fixed_name[PATH_MAX + 1] = {0}; - size_t len = strlen (name); - bool check_dir = false; - verify (PATH_MAX <= 4096); - if (PATH_MAX <= len) - errno = ENAMETOOLONG; - else if (len) + /* Approach based on the file. */ + + /* Open a handle to the file. + CreateFile + <https://msdn.microsoft.com/en-us/library/aa363858.aspx> + <https://msdn.microsoft.com/en-us/library/aa363874.aspx> */ + HANDLE h = + CreateFile (rname, + FILE_READ_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only + in case as different) makes sense only when applied to *all* + filesystem operations. */ + FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */, + NULL); + if (h != INVALID_HANDLE_VALUE) + { + ret = _gl_fstat_by_handle (h, rname, buf); + CloseHandle (h); + goto done; + } + } + + /* Test for root and UNC root directories. */ + if ((rlen == drive_prefix_len + 1 && ISSLASH (rname[drive_prefix_len])) + || is_unc_root (rname)) + goto failed; + + /* Fallback. */ + { + /* Approach based on the directory entry. */ + + if (strchr (rname, '?') != NULL || strchr (rname, '*') != NULL) + { + /* Other Windows API functions would fail with error + ERROR_INVALID_NAME. */ + if (malloca_rname != NULL) + freea (malloca_rname); + errno = ENOENT; + return -1; + } + + /* Get the details about the directory entry. This can be done through + FindFirstFile + <https://msdn.microsoft.com/en-us/library/aa364418.aspx> + <https://msdn.microsoft.com/en-us/library/aa365740.aspx> + or through + FindFirstFileEx with argument FindExInfoBasic + <https://msdn.microsoft.com/en-us/library/aa364419.aspx> + <https://msdn.microsoft.com/en-us/library/aa364415.aspx> + <https://msdn.microsoft.com/en-us/library/aa365740.aspx> */ + WIN32_FIND_DATA info; + HANDLE h = FindFirstFile (rname, &info); + if (h == INVALID_HANDLE_VALUE) + goto failed; + + /* Test for error conditions before starting to fill *buf. */ + if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) + { + FindClose (h); + if (malloca_rname != NULL) + freea (malloca_rname); + errno = EOVERFLOW; + return -1; + } + +# if _GL_WINDOWS_STAT_INODES + buf->st_dev = 0; +# if _GL_WINDOWS_STAT_INODES == 2 + buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; +# else /* _GL_WINDOWS_STAT_INODES == 1 */ + buf->st_ino = 0; +# endif +# else + /* st_ino is not wide enough for identifying a file on a device. + Without st_ino, st_dev is pointless. */ + buf->st_dev = 0; + buf->st_ino = 0; +# endif + + /* st_mode. */ + unsigned int mode = + /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ + ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) + | S_IREAD_UGO + | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - strcpy (fixed_name, name); - if (ISSLASH (fixed_name[len - 1])) + /* Determine whether the file is executable by looking at the file + name suffix. */ + if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) { - check_dir = true; - while (len && ISSLASH (fixed_name[len - 1])) - fixed_name[--len] = '\0'; - if (!len) - fixed_name[0] = '/'; + const char *last_dot = NULL; + const char *p; + for (p = info.cFileName; *p != '\0'; p++) + if (*p == '.') + last_dot = p; + if (last_dot != NULL) + { + const char *suffix = last_dot + 1; + if (_stricmp (suffix, "exe") == 0 + || _stricmp (suffix, "bat") == 0 + || _stricmp (suffix, "cmd") == 0 + || _stricmp (suffix, "com") == 0) + mode |= S_IEXEC_UGO; + } } - else - fixed_name[len++] = '/'; - result = orig_stat (fixed_name, st); - if (result == 0 && check_dir && !S_ISDIR (st->st_mode)) + } + buf->st_mode = mode; + + /* st_nlink. Ignore hard links here. */ + buf->st_nlink = 1; + + /* There's no easy way to map the Windows SID concept to an integer. */ + buf->st_uid = 0; + buf->st_gid = 0; + + /* st_rdev is irrelevant for normal files and directories. */ + buf->st_rdev = 0; + + /* st_size. */ + if (sizeof (buf->st_size) <= 4) + /* Range check already done above. */ + buf->st_size = info.nFileSizeLow; + else + buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; + + /* st_atime, st_mtime, st_ctime. */ +# if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); + buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); + buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); +# else + buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); + buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); + buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); +# endif + + FindClose (h); + + ret = 0; + } + + done: + if (ret >= 0 && check_dir && !S_ISDIR (buf->st_mode)) + { + errno = ENOTDIR; + ret = -1; + } + if (malloca_rname != NULL) + { + int saved_errno = errno; + freea (malloca_rname); + errno = saved_errno; + } + return ret; + } + + failed: + { + DWORD error = GetLastError (); + #if 0 + fprintf (stderr, "rpl_stat error 0x%x\n", (unsigned int) error); + #endif + + if (malloca_rname != NULL) + freea (malloca_rname); + + switch (error) + { + /* Some of these errors probably cannot happen with the specific flags + that we pass to CreateFile. But who knows... */ + case ERROR_FILE_NOT_FOUND: /* The last component of rname does not exist. */ + case ERROR_PATH_NOT_FOUND: /* Some directory component in rname does not exist. */ + case ERROR_BAD_PATHNAME: /* rname is such as '\\server'. */ + case ERROR_BAD_NET_NAME: /* rname is such as '\\server\nonexistentshare'. */ + case ERROR_INVALID_NAME: /* rname contains wildcards, misplaced colon, etc. */ + case ERROR_DIRECTORY: + errno = ENOENT; + break; + + case ERROR_ACCESS_DENIED: /* rname is such as 'C:\System Volume Information\foo'. */ + case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys' (second approach only). */ + /* XXX map to EACCESS or EPERM? */ + errno = EACCES; + break; + + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + + case ERROR_WRITE_PROTECT: + errno = EROFS; + break; + + case ERROR_WRITE_FAULT: + case ERROR_READ_FAULT: + case ERROR_GEN_FAILURE: + errno = EIO; + break; + + case ERROR_BUFFER_OVERFLOW: + case ERROR_FILENAME_EXCED_RANGE: + errno = ENAMETOOLONG; + break; + + case ERROR_DELETE_PENDING: /* XXX map to EACCESS or EPERM? */ + errno = EPERM; + break; + + default: + errno = EINVAL; + break; + } + + return -1; + } +#else + int result = orig_stat (name, buf); + if (result == 0) + { +# if REPLACE_FUNC_STAT_FILE + /* Solaris 9 mistakenly succeeds when given a non-directory with a + trailing slash. */ + if (!S_ISDIR (buf->st_mode)) + { + size_t len = strlen (name); + if (ISSLASH (name[len - 1])) { - result = -1; errno = ENOTDIR; + return -1; } } +# endif /* REPLACE_FUNC_STAT_FILE */ + result = stat_time_normalize (result, buf); } -#endif /* REPLACE_FUNC_STAT_DIR */ return result; +#endif } diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index 5f56eee..bbfa9ac 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C11 <stdalign.h>. - Copyright 2011-2017 Free Software Foundation, Inc. + Copyright 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Bruno Haible. */ @@ -53,7 +53,7 @@ #undef _Alignof /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9))) # ifdef __cplusplus @@ -103,7 +103,7 @@ # elif ((defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ - || 061200 <= __HP_cc || 061200 <= __HP_aCC \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__) # define _Alignas(a) __attribute__ ((__aligned__ (a))) # elif 1300 <= _MSC_VER diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h index 1067ed2..ebf1a2f 100644 --- a/lib/stdbool.in.h +++ b/lib/stdbool.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2003, 2006-2017 Free Software Foundation, Inc. +/* Copyright (C) 2001-2003, 2006-2018 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software; you can redistribute it and/or modify @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_STDBOOL_H #define _GL_STDBOOL_H @@ -82,9 +82,9 @@ typedef bool _Bool; /* If @HAVE__BOOL@: Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when the built-in _Bool type is used. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + https://lists.gnu.org/r/bug-coreutils/2005-10/msg00086.html Similar bugs are likely with other compilers as well; this file wouldn't be used if <stdbool.h> was working. So we override the _Bool type. diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 5b496a6..8329a9b 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ @@ -85,24 +85,28 @@ a hack in case the configure-time test was done with g++ even though we are currently compiling with gcc. */ #if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) +# if !GNULIB_defined_max_align_t /* On the x86, the maximum storage alignment of double, long, etc. is 4, but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, and the C11 standard allows this. Work around this problem by using __alignof__ (which returns 8 for double) rather than _Alignof (which returns 4), and align each union member accordingly. */ -# ifdef __GNUC__ -# define _GL_STDDEF_ALIGNAS(type) \ - __attribute__ ((__aligned__ (__alignof__ (type)))) -# else -# define _GL_STDDEF_ALIGNAS(type) /* */ -# endif +# ifdef __GNUC__ +# define _GL_STDDEF_ALIGNAS(type) \ + __attribute__ ((__aligned__ (__alignof__ (type)))) +# else +# define _GL_STDDEF_ALIGNAS(type) /* */ +# endif typedef union { char *__p _GL_STDDEF_ALIGNAS (char *); double __d _GL_STDDEF_ALIGNAS (double); long double __ld _GL_STDDEF_ALIGNAS (long double); long int __i _GL_STDDEF_ALIGNAS (long int); -} max_align_t; +} rpl_max_align_t; +# define max_align_t rpl_max_align_t +# define GNULIB_defined_max_align_t 1 +# endif #endif # endif /* _@GUARD_PREFIX@_STDDEF_H */ diff --git a/lib/stdint.in.h b/lib/stdint.in.h index d899c1e..94e7c81 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2017 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2018 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* * ISO C 99 <stdint.h> for platforms that lack it. @@ -128,8 +128,13 @@ Return an unspecified value if BITS == 0, adding a check to pacify picky compilers. */ -# define _STDINT_MIN(signed, bits, zero) \ - ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) +/* These are separate macros, because if you try to merge these macros into + a single one, HP-UX cc rejects the resulting expression in constant + expressions. */ +# define _STDINT_UNSIGNED_MIN(bits, zero) \ + (zero) +# define _STDINT_SIGNED_MIN(bits, zero) \ + (~ _STDINT_MAX (1, bits, zero)) # define _STDINT_MAX(signed, bits, zero) \ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) @@ -512,15 +517,15 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) # undef PTRDIFF_MAX # if @APPLE_UNIVERSAL_BUILD@ # ifdef _LP64 -# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (64, 0l) # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) # else -# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (32, 0) # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) # endif # else # define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) + _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) # define PTRDIFF_MAX \ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) # endif @@ -528,9 +533,13 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) /* sig_atomic_t limits */ # undef SIG_ATOMIC_MIN # undef SIG_ATOMIC_MAX -# define SIG_ATOMIC_MIN \ - _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) +# if @HAVE_SIGNED_SIG_ATOMIC_T@ +# define SIG_ATOMIC_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# else +# define SIG_ATOMIC_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# endif # define SIG_ATOMIC_MAX \ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) @@ -566,16 +575,26 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) # endif # undef WCHAR_MIN # undef WCHAR_MAX -# define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# if @HAVE_SIGNED_WCHAR_T@ +# define WCHAR_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# else +# define WCHAR_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# endif # define WCHAR_MAX \ _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) /* wint_t limits */ # undef WINT_MIN # undef WINT_MAX -# define WINT_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# if @HAVE_SIGNED_WINT_T@ +# define WINT_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# else +# define WINT_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# endif # define WINT_MAX \ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 75a945e..78d896e 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -1,5 +1,5 @@ /* Implementation details of FILE streams. - Copyright (C) 2007-2008, 2010-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Many stdio implementations have the same logic and therefore can share the same implementation of stdio extension API, except that some fields @@ -32,7 +32,7 @@ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __DragonFly__ /* DragonFly */ - /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ + /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/lib/libc/stdio/priv_stdio.h>. */ # define fp_ ((struct { struct __FILE_public pub; \ struct { unsigned char *_base; int _size; } _bf; \ void *cookie; \ @@ -49,7 +49,7 @@ fpos_t _offset; \ /* More fields, not relevant here. */ \ } *) fp) - /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ + /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/include/stdio.h>. */ # define _p pub._p # define _flags pub._flags # define _r pub._r @@ -60,7 +60,7 @@ # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Minix 3, Android */ /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> - and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ + and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ struct __sfileext { struct __sbuf _ub; /* ungetc buffer */ @@ -81,7 +81,7 @@ #ifdef __TANDEM /* NonStop Kernel */ # ifndef _IOERR /* These values were determined by the program 'stdioext-flags' at - <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */ # define _IOERR 0x40 # define _IOREAD 0x80 # define _IOWRT 0x4 @@ -99,6 +99,8 @@ int _file; \ unsigned int _flag; \ } *) fp) +# elif defined __VMS /* OpenVMS */ +# define fp_ ((struct _iobuf *) fp) # else # define fp_ fp # endif @@ -130,7 +132,7 @@ struct _gl_real_FILE # define fp_ ((struct _gl_real_FILE *) fp) /* These values were determined by a program similar to the one at - <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */ # define _IOREAD 0x1 # define _IOWRT 0x2 # define _IORW 0x4 diff --git a/lib/stdio-write.c b/lib/stdio-write.c index 8ad693b..5bd8d63 100644 --- a/lib/stdio-write.c +++ b/lib/stdio-write.c @@ -1,5 +1,5 @@ /* POSIX compatible FILE stream write function. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -39,7 +39,11 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> -# include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif # if GNULIB_NONBLOCKING # define CLEAR_ERRNO \ diff --git a/lib/stdio.in.h b/lib/stdio.in.h index d706377..b9a43bb 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdio.h>. - Copyright (C) 2004, 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -111,9 +111,9 @@ #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) -/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ +/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ /* But in any case avoid namespace pollution on glibc systems. */ -#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ && ! defined __GLIBC__ # include <unistd.h> #endif @@ -152,7 +152,7 @@ /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && defined __GNUC__ && defined __STDC__) @@ -610,7 +610,7 @@ _GL_CXXALIAS_SYS (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream)); /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 - <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, + <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, which sometimes causes an unwanted diagnostic for fwrite calls. This affects only function declaration attributes under certain versions of gcc and clang, and is not needed for C++. */ diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index b5cf9d3..b9701d5 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdlib.h>. - Copyright (C) 1995, 2001-2004, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -597,7 +597,7 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if !@HAVE_RANDOM@ || !@HAVE_DECL_INITSTATE@ _GL_FUNCDECL_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size) _GL_ARG_NONNULL ((2))); @@ -614,7 +614,7 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if !@HAVE_RANDOM@ || !@HAVE_DECL_SETSTATE@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); @@ -765,6 +765,23 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); #endif + +#if @GNULIB_REALLOCARRAY@ +# if ! @HAVE_REALLOCARRAY@ +_GL_FUNCDECL_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +# endif +_GL_CXXALIAS_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +_GL_CXXALIASWARN (reallocarray); +#elif defined GNULIB_POSIXCHECK +# undef reallocarray +# if HAVE_RAW_DECL_REALLOCARRAY +_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " + "use gnulib module reallocarray for portability"); +# endif +#endif + #if @GNULIB_REALPATH@ # if @REPLACE_REALPATH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/lib/str-two-way.h b/lib/str-two-way.h index 8b02f94..85489d1 100644 --- a/lib/str-two-way.h +++ b/lib/str-two-way.h @@ -1,5 +1,5 @@ /* Byte-wise substring search, using the Two-Way algorithm. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Eric Blake <ebb9@byu.net>, 2008. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Before including this file, you need to include <config.h> and <string.h>, and define: @@ -50,8 +50,8 @@ achieve improved (potentially sub-linear) performance. See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260, - http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm, - http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf + https://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm, + https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf */ /* Point at which computing a bad-byte shift table is likely to be diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c index 8548f4d..49f22c5 100644 --- a/lib/strcasecmp.c +++ b/lib/strcasecmp.c @@ -1,5 +1,5 @@ /* Case-insensitive string comparison function. - Copyright (C) 1998-1999, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strchrnul.c b/lib/strchrnul.c index 2d40658..8b3cd88 100644 --- a/lib/strchrnul.c +++ b/lib/strchrnul.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2003, 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strdup.c b/lib/strdup.c index 0c096e3..ce43940 100644 --- a/lib/strdup.c +++ b/lib/strdup.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2017 Free Software +/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/streq.h b/lib/streq.h index d40fc48..bde1b95 100644 --- a/lib/streq.h +++ b/lib/streq.h @@ -1,5 +1,5 @@ /* Optimized string comparison. - Copyright (C) 2001-2002, 2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ diff --git a/lib/strerror-override.c b/lib/strerror-override.c index fb2c74f..d3ad21e 100644 --- a/lib/strerror-override.c +++ b/lib/strerror-override.c @@ -1,6 +1,6 @@ /* strerror-override.c --- POSIX compatible system error routine - Copyright (C) 2010-2017 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ diff --git a/lib/strerror-override.h b/lib/strerror-override.h index c22d303..a96fd08 100644 --- a/lib/strerror-override.h +++ b/lib/strerror-override.h @@ -1,6 +1,6 @@ /* strerror-override.h --- POSIX compatible system error routine - Copyright (C) 2010-2017 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_STRERROR_OVERRIDE_H # define _GL_STRERROR_OVERRIDE_H diff --git a/lib/strerror.c b/lib/strerror.c index afeb9c8..36397bb 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strerror_r.c b/lib/strerror_r.c index 09ec8d9..c556c26 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -1,6 +1,6 @@ /* strerror_r.c --- POSIX compatible system error routine - Copyright (C) 2010-2017 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ @@ -28,6 +28,9 @@ #include <errno.h> #include <stdio.h> #include <stdlib.h> +#if !HAVE_SNPRINTF +# include <stdarg.h> +#endif #include "strerror-override.h" @@ -40,7 +43,7 @@ extern #endif int __xpg_strerror_r (int errnum, char *buf, size_t buflen); -#elif HAVE_DECL_STRERROR_R_ORIG && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) +#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) /* The system's strerror_r function is OK, except that its third argument is 'int', not 'size_t', or its return type is wrong. */ @@ -209,13 +212,16 @@ strerror_r (int errnum, char *buf, size_t buflen) # else ret = strerror_r (errnum, buf, buflen); - /* Some old implementations may return (-1, EINVAL) instead of EINVAL. */ + /* Some old implementations may return (-1, EINVAL) instead of EINVAL. + But on Haiku, valid error numbers are negative. */ +# if !defined __HAIKU__ if (ret < 0) ret = errno; +# endif # endif -# ifdef _AIX - /* AIX returns 0 rather than ERANGE when truncating strings; try +# if defined _AIX || defined __HAIKU__ + /* AIX and Haiku return 0 rather than ERANGE when truncating strings; try again until we are sure we got the entire string. */ if (!ret && strlen (buf) == buflen - 1) { @@ -329,8 +335,124 @@ strerror_r (int errnum, char *buf, size_t buflen) #endif +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* MSVC 14 defines names for many error codes in the range 100..140, + but _sys_errlist contains strings only for the error codes + < _sys_nerr = 43. */ + if (ret == EINVAL) + { + const char *errmsg; + + switch (errnum) + { + case 100 /* EADDRINUSE */: + errmsg = "Address already in use"; + break; + case 101 /* EADDRNOTAVAIL */: + errmsg = "Cannot assign requested address"; + break; + case 102 /* EAFNOSUPPORT */: + errmsg = "Address family not supported by protocol"; + break; + case 103 /* EALREADY */: + errmsg = "Operation already in progress"; + break; + case 105 /* ECANCELED */: + errmsg = "Operation canceled"; + break; + case 106 /* ECONNABORTED */: + errmsg = "Software caused connection abort"; + break; + case 107 /* ECONNREFUSED */: + errmsg = "Connection refused"; + break; + case 108 /* ECONNRESET */: + errmsg = "Connection reset by peer"; + break; + case 109 /* EDESTADDRREQ */: + errmsg = "Destination address required"; + break; + case 110 /* EHOSTUNREACH */: + errmsg = "No route to host"; + break; + case 112 /* EINPROGRESS */: + errmsg = "Operation now in progress"; + break; + case 113 /* EISCONN */: + errmsg = "Transport endpoint is already connected"; + break; + case 114 /* ELOOP */: + errmsg = "Too many levels of symbolic links"; + break; + case 115 /* EMSGSIZE */: + errmsg = "Message too long"; + break; + case 116 /* ENETDOWN */: + errmsg = "Network is down"; + break; + case 117 /* ENETRESET */: + errmsg = "Network dropped connection on reset"; + break; + case 118 /* ENETUNREACH */: + errmsg = "Network is unreachable"; + break; + case 119 /* ENOBUFS */: + errmsg = "No buffer space available"; + break; + case 123 /* ENOPROTOOPT */: + errmsg = "Protocol not available"; + break; + case 126 /* ENOTCONN */: + errmsg = "Transport endpoint is not connected"; + break; + case 128 /* ENOTSOCK */: + errmsg = "Socket operation on non-socket"; + break; + case 129 /* ENOTSUP */: + errmsg = "Not supported"; + break; + case 130 /* EOPNOTSUPP */: + errmsg = "Operation not supported"; + break; + case 132 /* EOVERFLOW */: + errmsg = "Value too large for defined data type"; + break; + case 133 /* EOWNERDEAD */: + errmsg = "Owner died"; + break; + case 134 /* EPROTO */: + errmsg = "Protocol error"; + break; + case 135 /* EPROTONOSUPPORT */: + errmsg = "Protocol not supported"; + break; + case 136 /* EPROTOTYPE */: + errmsg = "Protocol wrong type for socket"; + break; + case 138 /* ETIMEDOUT */: + errmsg = "Connection timed out"; + break; + case 140 /* EWOULDBLOCK */: + errmsg = "Operation would block"; + break; + default: + errmsg = NULL; + break; + } + if (errmsg != NULL) + ret = safe_copy (buf, buflen, errmsg); + } +#endif + if (ret == EINVAL && !*buf) - snprintf (buf, buflen, "Unknown error %d", errnum); + { +#if defined __HAIKU__ + /* For consistency with perror(). */ + snprintf (buf, buflen, "Unknown Application Error (%d)", errnum); +#else + snprintf (buf, buflen, "Unknown error %d", errnum); +#endif + } errno = saved_errno; return ret; diff --git a/lib/string.in.h b/lib/string.in.h index 9a6b311..29f4ba6 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like <string.h>. - Copyright (C) 1995-1996, 2001-2017 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -74,6 +74,23 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Clear a block of memory. The compiler will not delete a call to + this function, even if the block is dead after the call. */ +#if @GNULIB_EXPLICIT_BZERO@ +# if ! @HAVE_EXPLICIT_BZERO@ +_GL_FUNCDECL_SYS (explicit_bzero, void, + (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); +_GL_CXXALIASWARN (explicit_bzero); +#elif defined GNULIB_POSIXCHECK +# undef explicit_bzero +# if HAVE_RAW_DECL_EXPLICIT_BZERO +_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " + "use gnulib module explicit_bzero for portability"); +# endif +#endif + /* Find the index of the least-significant set bit. */ #if @GNULIB_FFSL@ # if !@HAVE_FFSL@ diff --git a/lib/strings.in.h b/lib/strings.in.h index 0374c94..b9d0a67 100644 --- a/lib/strings.in.h +++ b/lib/strings.in.h @@ -1,6 +1,6 @@ /* A substitute <strings.h>. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_STRINGS_H diff --git a/lib/stripslash.c b/lib/stripslash.c index 2d9d166..60c6781 100644 --- a/lib/stripslash.c +++ b/lib/stripslash.c @@ -1,6 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2017 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strncasecmp.c b/lib/strncasecmp.c index 2bb02d9..f750679 100644 --- a/lib/strncasecmp.c +++ b/lib/strncasecmp.c @@ -1,5 +1,5 @@ /* strncasecmp.c -- case insensitive string comparator - Copyright (C) 1998-1999, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strndup.c b/lib/strndup.c index 546e58c..b5c18dd 100644 --- a/lib/strndup.c +++ b/lib/strndup.c @@ -1,6 +1,6 @@ /* A replacement function, for systems that lack strndup. - Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2017 Free Software + Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strnlen.c b/lib/strnlen.c index 4cb1ca3..f0b1b8b 100644 --- a/lib/strnlen.c +++ b/lib/strnlen.c @@ -1,5 +1,5 @@ /* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strnlen1.c b/lib/strnlen1.c index 63f78a6..4459f6b 100644 --- a/lib/strnlen1.c +++ b/lib/strnlen1.c @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strnlen1.h b/lib/strnlen1.h index 86cb177..896a180 100644 --- a/lib/strnlen1.h +++ b/lib/strnlen1.h @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _STRNLEN1_H #define _STRNLEN1_H diff --git a/lib/strpbrk.c b/lib/strpbrk.c index c0b7e12..cc3f0aa 100644 --- a/lib/strpbrk.c +++ b/lib/strpbrk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006, 2009-2017 Free Software +/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006, 2009-2018 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strptime.c b/lib/strptime.c index c8e436e..6994ec4 100644 --- a/lib/strptime.c +++ b/lib/strptime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2004-2005, 2007, 2009-2017 Free Software Foundation, +/* Copyright (C) 2002, 2004-2005, 2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/strtok_r.c b/lib/strtok_r.c index bb59ae3..ef8e41d 100644 --- a/lib/strtok_r.c +++ b/lib/strtok_r.c @@ -1,5 +1,5 @@ /* Reentrant string tokenizer. Generic version. - Copyright (C) 1991, 1996-1999, 2001, 2004, 2007, 2009-2017 Free Software + Copyright (C) 1991, 1996-1999, 2001, 2004, 2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/lib/strtol.c b/lib/strtol.c index 751d1e0..55871b4 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -1,6 +1,6 @@ /* Convert string representation of a number into an integer value. - Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2017 Free Software + Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifdef _LIBC # define USE_NUMBER_GROUPING diff --git a/lib/strtoll.c b/lib/strtoll.c index d770e81..8aa10f4 100644 --- a/lib/strtoll.c +++ b/lib/strtoll.c @@ -1,5 +1,5 @@ /* Function to parse a 'long long int' from text. - Copyright (C) 1995-1997, 1999, 2001, 2009-2017 Free Software Foundation, + Copyright (C) 1995-1997, 1999, 2001, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #define QUAD 1 diff --git a/lib/symlink.c b/lib/symlink.c index 60d4c14..c1c4b40 100644 --- a/lib/symlink.c +++ b/lib/symlink.c @@ -1,5 +1,5 @@ /* Stub for symlink(). - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h index fc09209..efbf458 100644 --- a/lib/sys_file.in.h +++ b/lib/sys_file.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/file.h. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Richard W.M. Jones. */ diff --git a/lib/sys_ioctl.in.h b/lib/sys_ioctl.in.h index 7d410cd..42a5ca4 100644 --- a/lib/sys_ioctl.in.h +++ b/lib/sys_ioctl.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <sys/ioctl.h>. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_SYS_IOCTL_H @@ -31,6 +31,7 @@ /* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>, but not in <sys/ioctl.h>. + Haiku declares ioctl() in <unistd.h>, but not in <sys/ioctl.h>. But avoid namespace pollution on glibc systems. */ #ifndef __GLIBC__ # include <unistd.h> diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 616e77d..154e570 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -1,5 +1,5 @@ /* Substitute for <sys/select.h>. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index cf4f7bc..7a125e1 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -1,6 +1,6 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW) and for systems where it is incomplete. - Copyright (C) 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2018 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This file is supposed to be used on platforms that lack <sys/socket.h>, on platforms where <sys/socket.h> cannot be included standalone, and on @@ -141,6 +141,15 @@ struct sockaddr_storage # define SHUT_RDWR 2 # endif +# ifdef __VMS /* OpenVMS */ +# ifndef CMSG_SPACE +# define CMSG_SPACE(length) _CMSG_SPACE(length) +# endif +# ifndef CMSG_LEN +# define CMSG_LEN(length) _CMSG_LEN(length) +# endif +# endif + #else # ifdef __CYGWIN__ @@ -160,7 +169,7 @@ struct sockaddr_storage code may not run on older Windows releases then. My Windows 2000 box was not able to run the code, for example. The situation is slightly confusing because - <http://msdn.microsoft.com/en-us/library/ms738520> + <https://msdn.microsoft.com/en-us/library/ms738520> suggests that getaddrinfo should be available on all Windows releases. */ @@ -662,7 +671,7 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) and O_TEXT, O_BINARY (defined in "binary-io.h"). See also the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ # if @HAVE_ACCEPT4@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define accept4 rpl_accept4 diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index d5ca343..d96fde1 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -1,5 +1,5 @@ -/* Provide a more complete sys/stat header file. - Copyright (C) 2005-2017 Free Software Foundation, Inc. +/* Provide a more complete sys/stat.h header file. + Copyright (C) 2005-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ @@ -72,6 +72,75 @@ # define stat _stati64 #endif +/* Optionally, override 'struct stat' on native Windows. */ +#if @GNULIB_OVERRIDES_STRUCT_STAT@ + +# undef stat +# if @GNULIB_STAT@ +# define stat rpl_stat +# else + /* Provoke a clear link error if stat() is used as a function and + module 'stat' is not in use. */ +# define stat stat_used_without_requesting_gnulib_module_stat +# endif + +# if !GNULIB_defined_struct_stat +struct stat +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; +# if 0 + uid_t st_uid; +# else /* uid_t is not defined by default on native Windows. */ + short st_uid; +# endif +# if 0 + gid_t st_gid; +# else /* gid_t is not defined by default on native Windows. */ + short st_gid; +# endif + dev_t st_rdev; + off_t st_size; +# if 0 + blksize_t st_blksize; + blkcnt_t st_blocks; +# endif + +# if @WINDOWS_STAT_TIMESPEC@ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +# else + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +# endif +}; +# if @WINDOWS_STAT_TIMESPEC@ +# define st_atime st_atim.tv_sec +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec + /* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_STAT_TIMESPEC 1 +# endif +# define GNULIB_defined_struct_stat 1 +# endif + +/* Other possible values of st_mode. */ +# if 0 +# define _S_IFBLK 0x6000 +# endif +# if 0 +# define _S_IFLNK 0xA000 +# endif +# if 0 +# define _S_IFSOCK 0xC000 +# endif + +#endif + #ifndef S_IFIFO # ifdef _S_IFIFO # define S_IFIFO _S_IFIFO @@ -345,6 +414,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); # endif _GL_CXXALIASWARN (fstat); +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef fstat +# define fstat fstat_used_without_requesting_gnulib_module_fstat #elif @WINDOWS_64_BIT_ST_SIZE@ /* Above, we define stat to _stati64. */ # define fstat _fstati64 @@ -378,6 +450,9 @@ _GL_CXXALIAS_SYS (fstatat, int, (int fd, char const *name, struct stat *st, int flags)); # endif _GL_CXXALIASWARN (fstatat); +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef fstatat +# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat #elif defined GNULIB_POSIXCHECK # undef fstatat # if HAVE_RAW_DECL_FSTATAT @@ -476,6 +551,9 @@ _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); # if @HAVE_LSTAT@ _GL_CXXALIASWARN (lstat); # endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef lstat +# define lstat lstat_used_without_requesting_gnulib_module_lstat #elif defined GNULIB_POSIXCHECK # undef lstat # if HAVE_RAW_DECL_LSTAT @@ -625,63 +703,69 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " #if @GNULIB_STAT@ # if @REPLACE_STAT@ -/* We can't use the object-like #define stat rpl_stat, because of - struct stat. This means that rpl_stat will not be used if the user - does (stat)(a,b). Oh well. */ -# if defined _AIX && defined stat && defined _LARGE_FILES - /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, - so we have to replace stat64() instead of stat(). */ -# undef stat64 -# define stat64(name, st) rpl_stat (name, st) -# elif @WINDOWS_64_BIT_ST_SIZE@ - /* Above, we define stat to _stati64. */ -# if defined __MINGW32__ && defined _stati64 -# ifndef _USE_32BIT_TIME_T - /* The system headers define _stati64 to _stat64. */ -# undef _stat64 -# define _stat64(name, st) rpl_stat (name, st) +# if !@GNULIB_OVERRIDES_STRUCT_STAT@ + /* We can't use the object-like #define stat rpl_stat, because of + struct stat. This means that rpl_stat will not be used if the user + does (stat)(a,b). Oh well. */ +# if defined _AIX && defined stat && defined _LARGE_FILES + /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, + so we have to replace stat64() instead of stat(). */ +# undef stat64 +# define stat64(name, st) rpl_stat (name, st) +# elif @WINDOWS_64_BIT_ST_SIZE@ + /* Above, we define stat to _stati64. */ +# if defined __MINGW32__ && defined _stati64 +# ifndef _USE_32BIT_TIME_T + /* The system headers define _stati64 to _stat64. */ +# undef _stat64 +# define _stat64(name, st) rpl_stat (name, st) +# endif +# elif defined _MSC_VER && defined _stati64 +# ifdef _USE_32BIT_TIME_T + /* The system headers define _stati64 to _stat32i64. */ +# undef _stat32i64 +# define _stat32i64(name, st) rpl_stat (name, st) +# else + /* The system headers define _stati64 to _stat64. */ +# undef _stat64 +# define _stat64(name, st) rpl_stat (name, st) +# endif +# else +# undef _stati64 +# define _stati64(name, st) rpl_stat (name, st) # endif -# elif defined _MSC_VER && defined _stati64 +# elif defined __MINGW32__ && defined stat # ifdef _USE_32BIT_TIME_T - /* The system headers define _stati64 to _stat32i64. */ + /* The system headers define stat to _stat32i64. */ # undef _stat32i64 # define _stat32i64(name, st) rpl_stat (name, st) # else - /* The system headers define _stati64 to _stat64. */ + /* The system headers define stat to _stat64. */ # undef _stat64 # define _stat64(name, st) rpl_stat (name, st) # endif -# else -# undef _stati64 -# define _stati64(name, st) rpl_stat (name, st) -# endif -# elif defined __MINGW32__ && defined stat -# ifdef _USE_32BIT_TIME_T - /* The system headers define stat to _stat32i64. */ -# undef _stat32i64 -# define _stat32i64(name, st) rpl_stat (name, st) -# else - /* The system headers define stat to _stat64. */ -# undef _stat64 -# define _stat64(name, st) rpl_stat (name, st) -# endif -# elif defined _MSC_VER && defined stat -# ifdef _USE_32BIT_TIME_T - /* The system headers define stat to _stat32. */ -# undef _stat32 -# define _stat32(name, st) rpl_stat (name, st) -# else - /* The system headers define stat to _stat64i32. */ -# undef _stat64i32 -# define _stat64i32(name, st) rpl_stat (name, st) -# endif -# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */ -# undef stat -# define stat(name, st) rpl_stat (name, st) -# endif /* !_LARGE_FILES */ +# elif defined _MSC_VER && defined stat +# ifdef _USE_32BIT_TIME_T + /* The system headers define stat to _stat32. */ +# undef _stat32 +# define _stat32(name, st) rpl_stat (name, st) +# else + /* The system headers define stat to _stat64i32. */ +# undef _stat64i32 +# define _stat64i32(name, st) rpl_stat (name, st) +# endif +# else /* !(_AIX || __MINGW32__ || _MSC_VER) */ +# undef stat +# define stat(name, st) rpl_stat (name, st) +# endif /* !_LARGE_FILES */ +# endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */ _GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2)); # endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +/* see above: + #define stat stat_used_without_requesting_gnulib_module_stat + */ #elif defined GNULIB_POSIXCHECK # undef stat # if HAVE_RAW_DECL_STAT diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index 57739bc..b4a0e49 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/time.h. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 30ebfbd..7473716 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/types.h. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -42,6 +42,48 @@ # define _GL_WINDOWS_64_BIT_OFF_T 1 #endif +/* Override dev_t and ino_t if distinguishable inodes support is requested + on native Windows. */ +#if @WINDOWS_STAT_INODES@ + +# if @WINDOWS_STAT_INODES@ == 2 +/* Experimental, not useful in Windows 10. */ + +/* Define dev_t to a 64-bit type. */ +# if !defined GNULIB_defined_dev_t +typedef unsigned long long int rpl_dev_t; +# undef dev_t +# define dev_t rpl_dev_t +# define GNULIB_defined_dev_t 1 +# endif + +/* Define ino_t to a 128-bit type. */ +# if !defined GNULIB_defined_ino_t +/* MSVC does not have a 128-bit integer type. + GCC has a 128-bit integer type __int128, but only on 64-bit targets. */ +typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t; +# undef ino_t +# define ino_t rpl_ino_t +# define GNULIB_defined_ino_t 1 +# endif + +# else /* @WINDOWS_STAT_INODES@ == 1 */ + +/* Define ino_t to a 64-bit type. */ +# if !defined GNULIB_defined_ino_t +typedef unsigned long long int rpl_ino_t; +# undef ino_t +# define ino_t rpl_ino_t +# define GNULIB_defined_ino_t 1 +# endif + +# endif + +/* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_STAT_INODES @WINDOWS_STAT_INODES@ + +#endif + /* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */ /* But avoid namespace pollution on glibc systems. */ #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h index d45d846..0b5790b 100644 --- a/lib/sys_uio.in.h +++ b/lib/sys_uio.in.h @@ -1,5 +1,5 @@ /* Substitute for <sys/uio.h>. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/sys_wait.in.h b/lib/sys_wait.in.h index 1458d26..15a80dd 100644 --- a/lib/sys_wait.in.h +++ b/lib/sys_wait.in.h @@ -1,5 +1,5 @@ /* A POSIX-like <sys/wait.h>. - Copyright (C) 2001-2003, 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_SYS_WAIT_H diff --git a/lib/tempname.c b/lib/tempname.c index 2cd9032..da81263 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -1,6 +1,6 @@ /* tempname.c - generate the name of a temporary file. - Copyright (C) 1991-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */ @@ -69,7 +69,6 @@ # define __mkdir mkdir # define __open open # define __lxstat64(version, file, buf) lstat (file, buf) -# define __secure_getenv secure_getenv #endif #ifdef _LIBC @@ -279,7 +278,7 @@ try_nocreate (char *tmpl, void *flags _GL_UNUSED) { struct_stat64 st; - if (__lxstat64 (_STAT_VER, tmpl, &st) == 0) + if (__lxstat64 (_STAT_VER, tmpl, &st) == 0 || errno == EOVERFLOW) __set_errno (EEXIST); return errno == ENOENT ? 0 : -1; } diff --git a/lib/tempname.h b/lib/tempname.h index 1ca9748..4020c73 100644 --- a/lib/tempname.h +++ b/lib/tempname.h @@ -1,6 +1,6 @@ /* Create a temporary file or directory. - Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* header written by Eric Blake */ diff --git a/lib/time.in.h b/lib/time.in.h index fef8980..a2dca89 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -1,6 +1,6 @@ /* A more-standard <time.h>. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -120,6 +120,24 @@ _GL_CXXALIAS_SYS (nanosleep, int, _GL_CXXALIASWARN (nanosleep); # endif +/* Initialize time conversion information. */ +# if @GNULIB_TZSET@ +# if @REPLACE_TZSET@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tzset +# define tzset rpl_tzset +# endif +_GL_FUNCDECL_RPL (tzset, void, (void)); +_GL_CXXALIAS_RPL (tzset, void, (void)); +# else +# if ! @HAVE_TZSET@ +_GL_FUNCDECL_SYS (tzset, void, (void)); +# endif +_GL_CXXALIAS_SYS (tzset, void, (void)); +# endif +_GL_CXXALIASWARN (tzset); +# endif + /* Return the 'time_t' representation of TP and normalize TP. */ # if @GNULIB_MKTIME@ # if @REPLACE_MKTIME@ @@ -187,7 +205,7 @@ _GL_CXXALIASWARN (gmtime_r); /* Convert TIMER to RESULT, assuming local time and UTC respectively. See <http://www.opengroup.org/susv3xsh/localtime.html> and <http://www.opengroup.org/susv3xsh/gmtime.html>. */ -# if @GNULIB_GETTIMEOFDAY@ +# if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@ # if @REPLACE_LOCALTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef localtime @@ -202,7 +220,7 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); _GL_CXXALIASWARN (localtime); # endif -# if @GNULIB_GETTIMEOFDAY@ +# if 0 || @REPLACE_GMTIME@ # if @REPLACE_GMTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gmtime @@ -233,6 +251,41 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, _GL_CXXALIASWARN (strptime); # endif +/* Convert *TP to a date and time string. See + <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */ +# if @GNULIB_CTIME@ +# if @REPLACE_CTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define ctime rpl_ctime +# endif +_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); +# else +_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); +# endif +_GL_CXXALIASWARN (ctime); +# endif + +/* Convert *TP to a date and time string. See + <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */ +# if @GNULIB_STRFTIME@ +# if @REPLACE_STRFTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strftime rpl_strftime +# endif +_GL_FUNCDECL_RPL (strftime, size_t, (char *__buf, size_t __bufsize, + const char *__fmt, const struct tm *__tp) + _GL_ARG_NONNULL ((1, 3, 4))); +_GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize, + const char *__fmt, const struct tm *__tp)); +# else +_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize, + const char *__fmt, const struct tm *__tp)); +# endif +_GL_CXXALIASWARN (strftime); +# endif + # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ typedef struct tm_zone *timezone_t; _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); diff --git a/lib/time_r.c b/lib/time_r.c index 708a98b..3029780 100644 --- a/lib/time_r.c +++ b/lib/time_r.c @@ -1,6 +1,6 @@ /* Reentrant time functions like localtime_r. - Copyright (C) 2003, 2006-2007, 2010-2017 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2010-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/timegm.c b/lib/timegm.c index 957a3b8..7eb5ecb 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -1,6 +1,6 @@ /* Convert UTC calendar time to simple time. Like mktime but assumes UTC. - Copyright (C) 1994, 1997, 2003-2004, 2006-2007, 2009-2017 Free Software + Copyright (C) 1994, 1997, 2003-2004, 2006-2007, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/timespec.h b/lib/timespec.h index a5eca79..eef3030 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -1,6 +1,6 @@ /* timespec -- System time interface - Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2017 Free Software + Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if ! defined TIMESPEC_H # define TIMESPEC_H @@ -29,6 +29,12 @@ _GL_INLINE_HEADER_BEGIN # define _GL_TIMESPEC_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + +#include "verify.h" + /* Resolution of timespec timestamps (in units per second), and log base 10 of the resolution. */ @@ -63,23 +69,29 @@ make_timespec (time_t s, long int ns) any platform of interest to the GNU project, since all such platforms have 32-bit int or wider. - Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like + Replacing "a.tv_nsec - b.tv_nsec" with something like "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause this function to work in some cases where the above assumption is violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2, b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the extra instructions. Using a subtraction has the advantage of detecting some invalid cases on platforms that detect integer - overflow. - - The (int) cast avoids a gcc -Wconversion warning. */ + overflow. */ _GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE timespec_cmp (struct timespec a, struct timespec b) { - return (a.tv_sec < b.tv_sec ? -1 - : a.tv_sec > b.tv_sec ? 1 - : (int) (a.tv_nsec - b.tv_nsec)); + if (a.tv_sec < b.tv_sec) + return -1; + if (a.tv_sec > b.tv_sec) + return 1; + + /* Pacify gcc -Wstrict-overflow (bleeding-edge circa 2017-10-02). See: + http://lists.gnu.org/r/bug-gnulib/2017-10/msg00006.html */ + assume (-1 <= a.tv_nsec && a.tv_nsec <= 2 * TIMESPEC_RESOLUTION); + assume (-1 <= b.tv_nsec && b.tv_nsec <= 2 * TIMESPEC_RESOLUTION); + + return a.tv_nsec - b.tv_nsec; } /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be @@ -107,6 +119,10 @@ timespectod (struct timespec a) void gettime (struct timespec *); int settime (struct timespec const *); +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif diff --git a/lib/tmpdir.c b/lib/tmpdir.c index 2116dff..d7ee70e 100644 --- a/lib/tmpdir.c +++ b/lib/tmpdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001-2002, 2006, 2009-2017 Free Software Foundation, +/* Copyright (C) 1999, 2001-2002, 2006, 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Extracted from sysdeps/posix/tempname.c. */ diff --git a/lib/tmpdir.h b/lib/tmpdir.h index b0c3de7..53d3c0f 100644 --- a/lib/tmpdir.h +++ b/lib/tmpdir.h @@ -1,5 +1,5 @@ /* Determine a temporary directory. - Copyright (C) 2001-2002, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <stdbool.h> #include <stddef.h> @@ -1,6 +1,6 @@ /* uint64_t-like operations that work even on hosts lacking uint64_t - Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/unicase.in.h b/lib/unicase.in.h index e50e5fc..f97b68c 100644 --- a/lib/unicase.in.h +++ b/lib/unicase.in.h @@ -1,5 +1,5 @@ /* Unicode character case mappings. - Copyright (C) 2002, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _UNICASE_H #define _UNICASE_H diff --git a/lib/unicase/cased.c b/lib/unicase/cased.c index b2d0e1a..d5f7c53 100644 --- a/lib/unicase/cased.c +++ b/lib/unicase/cased.c @@ -1,5 +1,5 @@ /* Test whether a Unicode character is cased. - Copyright (C) 2002, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unicase/cased.h b/lib/unicase/cased.h index 156c1ee..7b1e5b1 100644 --- a/lib/unicase/cased.h +++ b/lib/unicase/cased.h @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Casing Properties of Unicode characters. */ -/* Generated automatically by gen-uni-tables.c for Unicode 8.0.0. */ +/* Generated automatically by gen-uni-tables.c for Unicode 9.0.0. */ #define header_0 16 #define header_2 9 #define header_3 127 @@ -11,7 +11,7 @@ struct int header[1]; int level1[2]; short level2[2 << 7]; - /*unsigned*/ int level3[20 << 4]; + /*unsigned*/ int level3[21 << 4]; } u_casing_property_cased = { @@ -265,11 +265,11 @@ u_casing_property_cased = -1, -1, -1, + 3 + 256 * sizeof (short) / sizeof (int) + 304, -1, -1, -1, - -1, - 3 + 256 * sizeof (short) / sizeof (int) + 304, + 3 + 256 * sizeof (short) / sizeof (int) + 320, -1, -1, -1, @@ -300,7 +300,7 @@ u_casing_property_cased = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x3F3FFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x000001FF, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, @@ -322,7 +322,7 @@ u_casing_property_cased = 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00003FFF, 0x3FFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, - 0xFFFF78FF, 0x00FF3FFF, 0x00000000, 0x07000000, + 0xFFFF78FF, 0x00FF7FFF, 0x00000000, 0x07000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0xF7FFFFFF, 0xFFFF003F, @@ -336,7 +336,7 @@ u_casing_property_cased = 0x00000000, 0x07FFFFFE, 0x07FFFFFE, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000FFFF, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0xFFFF0000, 0xFF0FFFFF, 0x0FFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -357,6 +357,10 @@ u_casing_property_cased = 0xFFFFFDFF, 0xFFFFFDFF, 0x00000FF7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0xFFFF03FF, 0xFFFF03FF, 0x000003FF, 0x00000000, 0x00000000, 0x00000000 } diff --git a/lib/unicase/caseprop.h b/lib/unicase/caseprop.h index ea06a91..f1e47b3 100644 --- a/lib/unicase/caseprop.h +++ b/lib/unicase/caseprop.h @@ -1,5 +1,5 @@ /* Case related properties of Unicode characters. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <stdbool.h> #include "unitypes.h" diff --git a/lib/unicase/context.h b/lib/unicase/context.h index 58abc80..64d331e 100644 --- a/lib/unicase/context.h +++ b/lib/unicase/context.h @@ -1,5 +1,5 @@ /* Case-mapping contexts of UTF-8/UTF-16/UTF-32 substring. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* The context of a prefix string combines the information of the "Before C" diff --git a/lib/unicase/empty-prefix-context.c b/lib/unicase/empty-prefix-context.c index 7cefbe9..01a362b 100644 --- a/lib/unicase/empty-prefix-context.c +++ b/lib/unicase/empty-prefix-context.c @@ -1,5 +1,5 @@ /* Case-mapping context of empty prefix string. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unicase/empty-suffix-context.c b/lib/unicase/empty-suffix-context.c index 909e412..16be069 100644 --- a/lib/unicase/empty-suffix-context.c +++ b/lib/unicase/empty-suffix-context.c @@ -1,5 +1,5 @@ /* Case-mapping context of empty suffix string. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unicase/ignorable.c b/lib/unicase/ignorable.c index 99e5b88..85ba619 100644 --- a/lib/unicase/ignorable.c +++ b/lib/unicase/ignorable.c @@ -1,5 +1,5 @@ /* Test whether a Unicode character is case-ignorable. - Copyright (C) 2002, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unicase/ignorable.h b/lib/unicase/ignorable.h index 3b7f1ff..a80b60d 100644 --- a/lib/unicase/ignorable.h +++ b/lib/unicase/ignorable.h @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Casing Properties of Unicode characters. */ -/* Generated automatically by gen-uni-tables.c for Unicode 8.0.0. */ +/* Generated automatically by gen-uni-tables.c for Unicode 9.0.0. */ #define header_0 16 #define header_2 9 #define header_3 127 @@ -11,7 +11,7 @@ struct int header[1]; int level1[15]; short level2[3 << 7]; - /*unsigned*/ int level3[42 << 4]; + /*unsigned*/ int level3[44 << 4]; } u_casing_property_case_ignorable = { @@ -176,6 +176,7 @@ u_casing_property_case_ignorable = 16 + 384 * sizeof (short) / sizeof (int) + 512, -1, -1, + 16 + 384 * sizeof (short) / sizeof (int) + 528, -1, -1, -1, @@ -214,11 +215,9 @@ u_casing_property_case_ignorable = -1, -1, -1, - -1, - 16 + 384 * sizeof (short) / sizeof (int) + 528, - -1, 16 + 384 * sizeof (short) / sizeof (int) + 544, -1, + 16 + 384 * sizeof (short) / sizeof (int) + 560, -1, -1, -1, @@ -256,8 +255,8 @@ u_casing_property_case_ignorable = -1, -1, -1, - 16 + 384 * sizeof (short) / sizeof (int) + 560, -1, + 16 + 384 * sizeof (short) / sizeof (int) + 576, -1, -1, -1, @@ -266,31 +265,32 @@ u_casing_property_case_ignorable = -1, -1, -1, - 16 + 384 * sizeof (short) / sizeof (int) + 576, - 16 + 384 * sizeof (short) / sizeof (int) + 592, -1, + 16 + 384 * sizeof (short) / sizeof (int) + 592, + 16 + 384 * sizeof (short) / sizeof (int) + 608, -1, -1, - 16 + 384 * sizeof (short) / sizeof (int) + 608, -1, + 16 + 384 * sizeof (short) / sizeof (int) + 624, -1, -1, + 16 + 384 * sizeof (short) / sizeof (int) + 640, -1, -1, -1, - 16 + 384 * sizeof (short) / sizeof (int) + 624, + 16 + 384 * sizeof (short) / sizeof (int) + 656, -1, -1, -1, -1, - 16 + 384 * sizeof (short) / sizeof (int) + 640, + 16 + 384 * sizeof (short) / sizeof (int) + 672, -1, -1, -1, -1, -1, -1, - 16 + 384 * sizeof (short) / sizeof (int) + 656, + 16 + 384 * sizeof (short) / sizeof (int) + 688, -1, -1, -1, @@ -437,7 +437,7 @@ u_casing_property_case_ignorable = 0x00028000, 0xFFFF0000, 0x000007FF, 0x00000000, 0x00000000, 0x0001FFC0, 0x00000000, 0x043FF800, 0xFFC00000, 0x00003FFF, 0x0E000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFF8, + 0x00000000, 0x00000000, 0xFFF00000, 0xFFFFFFFF, 0x00000007, 0x14000000, 0x00FE21FE, 0x0002000C, 0x00000002, 0x10000000, 0x0000201E, 0x0000000C, 0x00000006, 0x10000000, 0x00023986, 0x00230000, @@ -465,7 +465,7 @@ u_casing_property_case_ignorable = 0x001C0000, 0x001C0000, 0x000C0000, 0x000C0000, 0x00000000, 0x3FB00000, 0x208FFE40, 0x00000000, 0x00007800, 0x00000000, 0x00000008, 0x00000000, - 0x00000000, 0x00000200, 0x00000000, 0x00000000, + 0x00000060, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x0E040187, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x09800000, 0x00000000, 0x7F400000, 0x9FF81FE5, @@ -475,7 +475,7 @@ u_casing_property_case_ignorable = 0x00000000, 0x00CFF000, 0x00000000, 0x3F000000, 0x00000000, 0x00000000, 0xFFF70000, 0x031021FD, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0xFFFFFFFF, 0xF03FFFFF, + 0x00000000, 0x00000000, 0xFFFFFFFF, 0xF83FFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -509,7 +509,7 @@ u_casing_property_case_ignorable = 0xFFFFFFFF, 0x00000003, 0x00000000, 0x00000000, 0x00000700, 0x00000000, 0x00000000, 0x00000000, 0x00000844, 0x00000060, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000010, 0x0003FFFF, + 0x00000000, 0x00000000, 0x00000030, 0x0003FFFF, 0x00000000, 0x00003FC0, 0x0003FF80, 0x00000000, 0x00000007, 0x13C80000, 0x00008000, 0x00000060, 0x00000000, 0x00667E00, 0x00001008, 0x10010000, @@ -540,11 +540,11 @@ u_casing_property_case_ignorable = 0x00000003, 0x26780000, 0x00000000, 0x00000000, 0x00000007, 0x001FEF80, 0x00000000, 0x00080000, 0x00000003, 0x7FC00000, 0x00001C00, 0x00000000, - 0x00000000, 0x00D38000, 0x00000000, 0x00000000, + 0x00000000, 0x40D38000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0x000007F8, 0x00000003, 0x10000000, 0x00000001, 0x001F1FC0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0xFF000000, 0x0000005C, 0x00000000, 0x00000000, 0x85F80000, 0x0000000D, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xB03C0000, 0x30000001, 0x00000000, @@ -552,6 +552,10 @@ u_casing_property_case_ignorable = 0x00000000, 0x00BF2800, 0x00000000, 0x00000000, 0xE0000000, 0x00000FBC, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0xBF7F0000, 0x00000000, 0x00000000, + 0xFFFC0000, 0x006DFCFF, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x001F0000, 0x00000000, 0x007F0000, 0x0000000F, 0x00000000, @@ -559,7 +563,7 @@ u_casing_property_case_ignorable = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0xFFFF8000, 0x00000000, 0x00000000, 0x00000000, + 0xFFFF8000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x60000000, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -576,11 +580,15 @@ u_casing_property_case_ignorable = 0xF8000010, 0x0000FFFE, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0xF9FFFF7F, 0x000007DB, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x007F0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x007F0000, 0x00000000, + 0x00000000, 0x00000000, 0x000007F0, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF8000000, diff --git a/lib/unicase/simple-mapping.h b/lib/unicase/simple-mapping.h index b1de152..628b08e 100644 --- a/lib/unicase/simple-mapping.h +++ b/lib/unicase/simple-mapping.h @@ -1,5 +1,5 @@ /* Simple case mapping for Unicode characters. - Copyright (C) 2002, 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ ucs4_t FUNC (ucs4_t uc) diff --git a/lib/unicase/special-casing-table.gperf b/lib/unicase/special-casing-table.gperf index 8d8d14f..287f49a 100644 --- a/lib/unicase/special-casing-table.gperf +++ b/lib/unicase/special-casing-table.gperf @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Special casing rules of Unicode characters. */ -/* Generated automatically by gen-uni-tables.c for Unicode 8.0.0. */ +/* Generated automatically by gen-uni-tables.c for Unicode 9.0.0. */ struct special_casing_rule { char code[3]; }; %struct-type %language=ANSI-C diff --git a/lib/unicase/special-casing-table.h b/lib/unicase/special-casing-table.h index 45dc431..4943541 100644 --- a/lib/unicase/special-casing-table.h +++ b/lib/unicase/special-casing-table.h @@ -1,5 +1,5 @@ -/* ANSI-C code produced by gperf version 3.0.4 */ -/* Command-line: gperf -m 10 lib/unicase/special-casing-table.gperf */ +/* ANSI-C code produced by gperf version 3.1 */ +/* Command-line: gperf -m 10 ./unicase/special-casing-table.gperf */ /* Computed positions: -k'1-3' */ @@ -19,7 +19,7 @@ inline #endif /*ARGSUSED*/ static unsigned int -gl_unicase_special_hash (register const char *str, register unsigned int len) +gl_unicase_special_hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { @@ -53,14 +53,8 @@ gl_unicase_special_hash (register const char *str, register unsigned int len) return asso_values[(unsigned char)str[2]+1] + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]]; } -#ifdef __GNUC__ -__inline -#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif -#endif const struct special_casing_rule * -gl_unicase_special_lookup (const char *str, size_t len) +gl_unicase_special_lookup (register const char *str, register size_t len) { static const unsigned char lengthtable[] = { @@ -76,257 +70,257 @@ gl_unicase_special_lookup (const char *str, size_t len) }; static const struct special_casing_rule wordlist[] = { -#line 126 "lib/unicase/special-casing-table.gperf" +#line 126 "./unicase/special-casing-table.gperf" {"\373\001\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0046, 0x0049, 0 }, { 0xFB01, 0, 0 }, { 0x0046, 0x0069, 0 }, { 0x0066, 0x0069, 0 }}, -#line 31 "lib/unicase/special-casing-table.gperf" +#line 31 "./unicase/special-casing-table.gperf" {"\001I\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x02BC, 0x004E, 0 }, { 0x0149, 0, 0 }, { 0x02BC, 0x004E, 0 }, { 0x02BC, 0x006E, 0 }}, -#line 125 "lib/unicase/special-casing-table.gperf" +#line 125 "./unicase/special-casing-table.gperf" {"\373\000\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0046, 0x0046, 0 }, { 0xFB00, 0, 0 }, { 0x0046, 0x0066, 0 }, { 0x0066, 0x0066, 0 }}, -#line 15 "lib/unicase/special-casing-table.gperf" +#line 15 "./unicase/special-casing-table.gperf" {"\000I\000", 1, SCC_MORE_ABOVE , { 'l', 't' }, { 0x0049, 0, 0 }, { 0x0069, 0x0307, 0 }, { 0x0049, 0, 0 }, { 0x0069, 0, 0 }}, -#line 127 "lib/unicase/special-casing-table.gperf" +#line 127 "./unicase/special-casing-table.gperf" {"\373\002\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0046, 0x004C, 0 }, { 0xFB02, 0, 0 }, { 0x0046, 0x006C, 0 }, { 0x0066, 0x006C, 0 }}, -#line 128 "lib/unicase/special-casing-table.gperf" +#line 128 "./unicase/special-casing-table.gperf" {"\373\003\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0046, 0x0046, 0x0049 }, { 0xFB03, 0, 0 }, { 0x0046, 0x0066, 0x0069 }, { 0x0066, 0x0066, 0x0069 }}, -#line 28 "lib/unicase/special-casing-table.gperf" +#line 28 "./unicase/special-casing-table.gperf" {"\0010\000", 1, SCC_ALWAYS , { 't', 'r' }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }}, -#line 16 "lib/unicase/special-casing-table.gperf" +#line 16 "./unicase/special-casing-table.gperf" {"\000I\001", 1, -SCC_BEFORE_DOT , { 't', 'r' }, { 0x0049, 0, 0 }, { 0x0131, 0, 0 }, { 0x0049, 0, 0 }, { 0x0131, 0, 0 }}, -#line 17 "lib/unicase/special-casing-table.gperf" +#line 17 "./unicase/special-casing-table.gperf" {"\000I\002", 1, -SCC_BEFORE_DOT , { 'a', 'z' }, { 0x0049, 0, 0 }, { 0x0131, 0, 0 }, { 0x0049, 0, 0 }, { 0x0131, 0, 0 }}, -#line 33 "lib/unicase/special-casing-table.gperf" +#line 33 "./unicase/special-casing-table.gperf" {"\003\007\000", 1, SCC_AFTER_SOFT_DOTTED, { 'l', 't' }, { 0, 0, 0 }, { 0x0307, 0, 0 }, { 0, 0, 0 }, { 0x0307, 0, 0 }}, -#line 29 "lib/unicase/special-casing-table.gperf" +#line 29 "./unicase/special-casing-table.gperf" {"\0010\001", 1, SCC_ALWAYS , { 'a', 'z' }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }}, -#line 30 "lib/unicase/special-casing-table.gperf" +#line 30 "./unicase/special-casing-table.gperf" {"\0010\002", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0130, 0, 0 }, { 0x0069, 0x0307, 0 }, { 0x0130, 0, 0 }, { 0x0069, 0x0307, 0 }}, -#line 130 "lib/unicase/special-casing-table.gperf" +#line 130 "./unicase/special-casing-table.gperf" {"\373\005\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0053, 0x0054, 0 }, { 0xFB05, 0, 0 }, { 0x0053, 0x0074, 0 }, { 0x0073, 0x0074, 0 }}, -#line 34 "lib/unicase/special-casing-table.gperf" +#line 34 "./unicase/special-casing-table.gperf" {"\003\007\001", 1, SCC_AFTER_I , { 't', 'r' }, { 0x0307, 0, 0 }, { 0, 0, 0 }, { 0x0307, 0, 0 }, { 0x0307, 0, 0 }}, -#line 35 "lib/unicase/special-casing-table.gperf" +#line 35 "./unicase/special-casing-table.gperf" {"\003\007\002", 0, SCC_AFTER_I , { 'a', 'z' }, { 0x0307, 0, 0 }, { 0, 0, 0 }, { 0x0307, 0, 0 }, { 0x0307, 0, 0 }}, -#line 19 "lib/unicase/special-casing-table.gperf" +#line 19 "./unicase/special-casing-table.gperf" {"\000I\004", 0, SCC_ALWAYS , { 'a', 'z' }, { 0x0049, 0, 0 }, { 0x0069, 0, 0 }, { 0x0049, 0, 0 }, { 0x0131, 0, 0 }}, -#line 23 "lib/unicase/special-casing-table.gperf" +#line 23 "./unicase/special-casing-table.gperf" {"\000\314\000", 0, SCC_ALWAYS , { 'l', 't' }, { 0x00CC, 0, 0 }, { 0x0069, 0x0307, 0x0300 }, { 0x00CC, 0, 0 }, { 0x00EC, 0, 0 }}, -#line 109 "lib/unicase/special-casing-table.gperf" +#line 109 "./unicase/special-casing-table.gperf" {"\037\314\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0397, 0x0399, 0 }, { 0x1FC3, 0, 0 }, { 0x1FCC, 0, 0 }, { 0x03B7, 0x03B9, 0 }}, -#line 85 "lib/unicase/special-casing-table.gperf" +#line 85 "./unicase/special-casing-table.gperf" {"\037\243\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6B, 0x0399, 0 }, { 0x1FA3, 0, 0 }, { 0x1FAB, 0, 0 }, { 0x1F63, 0x03B9, 0 }}, -#line 80 "lib/unicase/special-casing-table.gperf" +#line 80 "./unicase/special-casing-table.gperf" {"\037\236\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2E, 0x0399, 0 }, { 0x1F96, 0, 0 }, { 0x1F9E, 0, 0 }, { 0x1F26, 0x03B9, 0 }}, -#line 37 "lib/unicase/special-casing-table.gperf" +#line 37 "./unicase/special-casing-table.gperf" {"\003\243\000", 0, SCC_FINAL_SIGMA , { '\0', '\0' }, { 0x03A3, 0, 0 }, { 0x03C2, 0, 0 }, { 0x03A3, 0, 0 }, { 0x03C3, 0, 0 }}, -#line 45 "lib/unicase/special-casing-table.gperf" +#line 45 "./unicase/special-casing-table.gperf" {"\036\236\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1E9E, 0, 0 }, { 0x00DF, 0, 0 }, { 0x1E9E, 0, 0 }, { 0x0073, 0x0073, 0 }}, -#line 76 "lib/unicase/special-casing-table.gperf" +#line 76 "./unicase/special-casing-table.gperf" {"\037\232\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2A, 0x0399, 0 }, { 0x1F92, 0, 0 }, { 0x1F9A, 0, 0 }, { 0x1F22, 0x03B9, 0 }}, -#line 75 "lib/unicase/special-casing-table.gperf" +#line 75 "./unicase/special-casing-table.gperf" {"\037\231\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F29, 0x0399, 0 }, { 0x1F91, 0, 0 }, { 0x1F99, 0, 0 }, { 0x1F21, 0x03B9, 0 }}, -#line 44 "lib/unicase/special-casing-table.gperf" +#line 44 "./unicase/special-casing-table.gperf" {"\036\232\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0041, 0x02BE, 0 }, { 0x1E9A, 0, 0 }, { 0x0041, 0x02BE, 0 }, { 0x0061, 0x02BE, 0 }}, -#line 43 "lib/unicase/special-casing-table.gperf" +#line 43 "./unicase/special-casing-table.gperf" {"\036\231\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0059, 0x030A, 0 }, { 0x1E99, 0, 0 }, { 0x0059, 0x030A, 0 }, { 0x0079, 0x030A, 0 }}, -#line 74 "lib/unicase/special-casing-table.gperf" +#line 74 "./unicase/special-casing-table.gperf" {"\037\230\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F28, 0x0399, 0 }, { 0x1F90, 0, 0 }, { 0x1F98, 0, 0 }, { 0x1F20, 0x03B9, 0 }}, -#line 73 "lib/unicase/special-casing-table.gperf" +#line 73 "./unicase/special-casing-table.gperf" {"\037\227\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2F, 0x0399, 0 }, { 0x1F97, 0, 0 }, { 0x1F9F, 0, 0 }, { 0x1F27, 0x03B9, 0 }}, -#line 42 "lib/unicase/special-casing-table.gperf" +#line 42 "./unicase/special-casing-table.gperf" {"\036\230\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0057, 0x030A, 0 }, { 0x1E98, 0, 0 }, { 0x0057, 0x030A, 0 }, { 0x0077, 0x030A, 0 }}, -#line 41 "lib/unicase/special-casing-table.gperf" +#line 41 "./unicase/special-casing-table.gperf" {"\036\227\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0054, 0x0308, 0 }, { 0x1E97, 0, 0 }, { 0x0054, 0x0308, 0 }, { 0x0074, 0x0308, 0 }}, -#line 72 "lib/unicase/special-casing-table.gperf" +#line 72 "./unicase/special-casing-table.gperf" {"\037\226\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2E, 0x0399, 0 }, { 0x1F96, 0, 0 }, { 0x1F9E, 0, 0 }, { 0x1F26, 0x03B9, 0 }}, -#line 66 "lib/unicase/special-casing-table.gperf" +#line 66 "./unicase/special-casing-table.gperf" {"\037\220\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F28, 0x0399, 0 }, { 0x1F90, 0, 0 }, { 0x1F98, 0, 0 }, { 0x1F20, 0x03B9, 0 }}, -#line 40 "lib/unicase/special-casing-table.gperf" +#line 40 "./unicase/special-casing-table.gperf" {"\036\226\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0048, 0x0331, 0 }, { 0x1E96, 0, 0 }, { 0x0048, 0x0331, 0 }, { 0x0068, 0x0331, 0 }}, -#line 36 "lib/unicase/special-casing-table.gperf" +#line 36 "./unicase/special-casing-table.gperf" {"\003\220\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0399, 0x0308, 0x0301 }, { 0x0390, 0, 0 }, { 0x0399, 0x0308, 0x0301 }, { 0x03B9, 0x0308, 0x0301 }}, -#line 57 "lib/unicase/special-casing-table.gperf" +#line 57 "./unicase/special-casing-table.gperf" {"\037\207\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0F, 0x0399, 0 }, { 0x1F87, 0, 0 }, { 0x1F8F, 0, 0 }, { 0x1F07, 0x03B9, 0 }}, -#line 21 "lib/unicase/special-casing-table.gperf" +#line 21 "./unicase/special-casing-table.gperf" {"\000i\000", 1, SCC_ALWAYS , { 't', 'r' }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }}, -#line 124 "lib/unicase/special-casing-table.gperf" +#line 124 "./unicase/special-casing-table.gperf" {"\037\374\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A9, 0x0399, 0 }, { 0x1FF3, 0, 0 }, { 0x1FFC, 0, 0 }, { 0x03C9, 0x03B9, 0 }}, -#line 129 "lib/unicase/special-casing-table.gperf" +#line 129 "./unicase/special-casing-table.gperf" {"\373\004\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0046, 0x0046, 0x004C }, { 0xFB04, 0, 0 }, { 0x0046, 0x0066, 0x006C }, { 0x0066, 0x0066, 0x006C }}, -#line 123 "lib/unicase/special-casing-table.gperf" +#line 123 "./unicase/special-casing-table.gperf" {"\037\367\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A9, 0x0342, 0x0399 }, { 0x1FF7, 0, 0 }, { 0x03A9, 0x0342, 0x0345 }, { 0x03C9, 0x0342, 0x03B9 }}, -#line 22 "lib/unicase/special-casing-table.gperf" +#line 22 "./unicase/special-casing-table.gperf" {"\000i\001", 0, SCC_ALWAYS , { 'a', 'z' }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }, { 0x0130, 0, 0 }, { 0x0069, 0, 0 }}, -#line 18 "lib/unicase/special-casing-table.gperf" +#line 18 "./unicase/special-casing-table.gperf" {"\000I\003", 1, SCC_ALWAYS , { 't', 'r' }, { 0x0049, 0, 0 }, { 0x0069, 0, 0 }, { 0x0049, 0, 0 }, { 0x0131, 0, 0 }}, -#line 122 "lib/unicase/special-casing-table.gperf" +#line 122 "./unicase/special-casing-table.gperf" {"\037\366\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A9, 0x0342, 0 }, { 0x1FF6, 0, 0 }, { 0x03A9, 0x0342, 0 }, { 0x03C9, 0x0342, 0 }}, -#line 121 "lib/unicase/special-casing-table.gperf" +#line 121 "./unicase/special-casing-table.gperf" {"\037\364\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x038F, 0x0399, 0 }, { 0x1FF4, 0, 0 }, { 0x038F, 0x0345, 0 }, { 0x03CE, 0x03B9, 0 }}, -#line 39 "lib/unicase/special-casing-table.gperf" +#line 39 "./unicase/special-casing-table.gperf" {"\005\207\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0535, 0x0552, 0 }, { 0x0587, 0, 0 }, { 0x0535, 0x0582, 0 }, { 0x0565, 0x0582, 0 }}, -#line 120 "lib/unicase/special-casing-table.gperf" +#line 120 "./unicase/special-casing-table.gperf" {"\037\363\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A9, 0x0399, 0 }, { 0x1FF3, 0, 0 }, { 0x1FFC, 0, 0 }, { 0x03C9, 0x03B9, 0 }}, -#line 119 "lib/unicase/special-casing-table.gperf" +#line 119 "./unicase/special-casing-table.gperf" {"\037\362\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1FFA, 0x0399, 0 }, { 0x1FF2, 0, 0 }, { 0x1FFA, 0x0345, 0 }, { 0x1F7C, 0x03B9, 0 }}, -#line 32 "lib/unicase/special-casing-table.gperf" +#line 32 "./unicase/special-casing-table.gperf" {"\001\360\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x004A, 0x030C, 0 }, { 0x01F0, 0, 0 }, { 0x004A, 0x030C, 0 }, { 0x006A, 0x030C, 0 }}, -#line 118 "lib/unicase/special-casing-table.gperf" +#line 118 "./unicase/special-casing-table.gperf" {"\037\347\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0308, 0x0342 }, { 0x1FE7, 0, 0 }, { 0x03A5, 0x0308, 0x0342 }, { 0x03C5, 0x0308, 0x0342 }}, -#line 117 "lib/unicase/special-casing-table.gperf" +#line 117 "./unicase/special-casing-table.gperf" {"\037\346\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0342, 0 }, { 0x1FE6, 0, 0 }, { 0x03A5, 0x0342, 0 }, { 0x03C5, 0x0342, 0 }}, -#line 116 "lib/unicase/special-casing-table.gperf" +#line 116 "./unicase/special-casing-table.gperf" {"\037\344\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A1, 0x0313, 0 }, { 0x1FE4, 0, 0 }, { 0x03A1, 0x0313, 0 }, { 0x03C1, 0x0313, 0 }}, -#line 115 "lib/unicase/special-casing-table.gperf" +#line 115 "./unicase/special-casing-table.gperf" {"\037\343\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0308, 0x0301 }, { 0x1FE3, 0, 0 }, { 0x03A5, 0x0308, 0x0301 }, { 0x03C5, 0x0308, 0x0301 }}, -#line 114 "lib/unicase/special-casing-table.gperf" +#line 114 "./unicase/special-casing-table.gperf" {"\037\342\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0308, 0x0300 }, { 0x1FE2, 0, 0 }, { 0x03A5, 0x0308, 0x0300 }, { 0x03C5, 0x0308, 0x0300 }}, -#line 25 "lib/unicase/special-casing-table.gperf" +#line 25 "./unicase/special-casing-table.gperf" {"\000\337\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0053, 0x0053, 0 }, { 0x00DF, 0, 0 }, { 0x0053, 0x0073, 0 }, { 0x0073, 0x0073, 0 }}, -#line 113 "lib/unicase/special-casing-table.gperf" +#line 113 "./unicase/special-casing-table.gperf" {"\037\327\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0399, 0x0308, 0x0342 }, { 0x1FD7, 0, 0 }, { 0x0399, 0x0308, 0x0342 }, { 0x03B9, 0x0308, 0x0342 }}, -#line 112 "lib/unicase/special-casing-table.gperf" +#line 112 "./unicase/special-casing-table.gperf" {"\037\326\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0399, 0x0342, 0 }, { 0x1FD6, 0, 0 }, { 0x0399, 0x0342, 0 }, { 0x03B9, 0x0342, 0 }}, -#line 111 "lib/unicase/special-casing-table.gperf" +#line 111 "./unicase/special-casing-table.gperf" {"\037\323\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0399, 0x0308, 0x0301 }, { 0x1FD3, 0, 0 }, { 0x0399, 0x0308, 0x0301 }, { 0x03B9, 0x0308, 0x0301 }}, -#line 110 "lib/unicase/special-casing-table.gperf" +#line 110 "./unicase/special-casing-table.gperf" {"\037\322\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0399, 0x0308, 0x0300 }, { 0x1FD2, 0, 0 }, { 0x0399, 0x0308, 0x0300 }, { 0x03B9, 0x0308, 0x0300 }}, -#line 24 "lib/unicase/special-casing-table.gperf" +#line 24 "./unicase/special-casing-table.gperf" {"\000\315\000", 0, SCC_ALWAYS , { 'l', 't' }, { 0x00CD, 0, 0 }, { 0x0069, 0x0307, 0x0301 }, { 0x00CD, 0, 0 }, { 0x00ED, 0, 0 }}, -#line 108 "lib/unicase/special-casing-table.gperf" +#line 108 "./unicase/special-casing-table.gperf" {"\037\307\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0397, 0x0342, 0x0399 }, { 0x1FC7, 0, 0 }, { 0x0397, 0x0342, 0x0345 }, { 0x03B7, 0x0342, 0x03B9 }}, -#line 107 "lib/unicase/special-casing-table.gperf" +#line 107 "./unicase/special-casing-table.gperf" {"\037\306\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0397, 0x0342, 0 }, { 0x1FC6, 0, 0 }, { 0x0397, 0x0342, 0 }, { 0x03B7, 0x0342, 0 }}, -#line 106 "lib/unicase/special-casing-table.gperf" +#line 106 "./unicase/special-casing-table.gperf" {"\037\304\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0389, 0x0399, 0 }, { 0x1FC4, 0, 0 }, { 0x0389, 0x0345, 0 }, { 0x03AE, 0x03B9, 0 }}, -#line 105 "lib/unicase/special-casing-table.gperf" +#line 105 "./unicase/special-casing-table.gperf" {"\037\303\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0397, 0x0399, 0 }, { 0x1FC3, 0, 0 }, { 0x1FCC, 0, 0 }, { 0x03B7, 0x03B9, 0 }}, -#line 104 "lib/unicase/special-casing-table.gperf" +#line 104 "./unicase/special-casing-table.gperf" {"\037\302\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1FCA, 0x0399, 0 }, { 0x1FC2, 0, 0 }, { 0x1FCA, 0x0345, 0 }, { 0x1F74, 0x03B9, 0 }}, -#line 103 "lib/unicase/special-casing-table.gperf" +#line 103 "./unicase/special-casing-table.gperf" {"\037\274\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0391, 0x0399, 0 }, { 0x1FB3, 0, 0 }, { 0x1FBC, 0, 0 }, { 0x03B1, 0x03B9, 0 }}, -#line 102 "lib/unicase/special-casing-table.gperf" +#line 102 "./unicase/special-casing-table.gperf" {"\037\267\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0391, 0x0342, 0x0399 }, { 0x1FB7, 0, 0 }, { 0x0391, 0x0342, 0x0345 }, { 0x03B1, 0x0342, 0x03B9 }}, -#line 101 "lib/unicase/special-casing-table.gperf" +#line 101 "./unicase/special-casing-table.gperf" {"\037\266\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0391, 0x0342, 0 }, { 0x1FB6, 0, 0 }, { 0x0391, 0x0342, 0 }, { 0x03B1, 0x0342, 0 }}, -#line 100 "lib/unicase/special-casing-table.gperf" +#line 100 "./unicase/special-casing-table.gperf" {"\037\264\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0386, 0x0399, 0 }, { 0x1FB4, 0, 0 }, { 0x0386, 0x0345, 0 }, { 0x03AC, 0x03B9, 0 }}, -#line 99 "lib/unicase/special-casing-table.gperf" +#line 99 "./unicase/special-casing-table.gperf" {"\037\263\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0391, 0x0399, 0 }, { 0x1FB3, 0, 0 }, { 0x1FBC, 0, 0 }, { 0x03B1, 0x03B9, 0 }}, -#line 98 "lib/unicase/special-casing-table.gperf" +#line 98 "./unicase/special-casing-table.gperf" {"\037\262\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1FBA, 0x0399, 0 }, { 0x1FB2, 0, 0 }, { 0x1FBA, 0x0345, 0 }, { 0x1F70, 0x03B9, 0 }}, -#line 38 "lib/unicase/special-casing-table.gperf" +#line 38 "./unicase/special-casing-table.gperf" {"\003\260\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0308, 0x0301 }, { 0x03B0, 0, 0 }, { 0x03A5, 0x0308, 0x0301 }, { 0x03C5, 0x0308, 0x0301 }}, -#line 97 "lib/unicase/special-casing-table.gperf" +#line 97 "./unicase/special-casing-table.gperf" {"\037\257\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6F, 0x0399, 0 }, { 0x1FA7, 0, 0 }, { 0x1FAF, 0, 0 }, { 0x1F67, 0x03B9, 0 }}, -#line 96 "lib/unicase/special-casing-table.gperf" +#line 96 "./unicase/special-casing-table.gperf" {"\037\256\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6E, 0x0399, 0 }, { 0x1FA6, 0, 0 }, { 0x1FAE, 0, 0 }, { 0x1F66, 0x03B9, 0 }}, -#line 95 "lib/unicase/special-casing-table.gperf" +#line 95 "./unicase/special-casing-table.gperf" {"\037\255\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6D, 0x0399, 0 }, { 0x1FA5, 0, 0 }, { 0x1FAD, 0, 0 }, { 0x1F65, 0x03B9, 0 }}, -#line 94 "lib/unicase/special-casing-table.gperf" +#line 94 "./unicase/special-casing-table.gperf" {"\037\254\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6C, 0x0399, 0 }, { 0x1FA4, 0, 0 }, { 0x1FAC, 0, 0 }, { 0x1F64, 0x03B9, 0 }}, -#line 93 "lib/unicase/special-casing-table.gperf" +#line 93 "./unicase/special-casing-table.gperf" {"\037\253\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6B, 0x0399, 0 }, { 0x1FA3, 0, 0 }, { 0x1FAB, 0, 0 }, { 0x1F63, 0x03B9, 0 }}, -#line 92 "lib/unicase/special-casing-table.gperf" +#line 92 "./unicase/special-casing-table.gperf" {"\037\252\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6A, 0x0399, 0 }, { 0x1FA2, 0, 0 }, { 0x1FAA, 0, 0 }, { 0x1F62, 0x03B9, 0 }}, -#line 91 "lib/unicase/special-casing-table.gperf" +#line 91 "./unicase/special-casing-table.gperf" {"\037\251\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F69, 0x0399, 0 }, { 0x1FA1, 0, 0 }, { 0x1FA9, 0, 0 }, { 0x1F61, 0x03B9, 0 }}, -#line 90 "lib/unicase/special-casing-table.gperf" +#line 90 "./unicase/special-casing-table.gperf" {"\037\250\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F68, 0x0399, 0 }, { 0x1FA0, 0, 0 }, { 0x1FA8, 0, 0 }, { 0x1F60, 0x03B9, 0 }}, -#line 89 "lib/unicase/special-casing-table.gperf" +#line 89 "./unicase/special-casing-table.gperf" {"\037\247\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6F, 0x0399, 0 }, { 0x1FA7, 0, 0 }, { 0x1FAF, 0, 0 }, { 0x1F67, 0x03B9, 0 }}, -#line 88 "lib/unicase/special-casing-table.gperf" +#line 88 "./unicase/special-casing-table.gperf" {"\037\246\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6E, 0x0399, 0 }, { 0x1FA6, 0, 0 }, { 0x1FAE, 0, 0 }, { 0x1F66, 0x03B9, 0 }}, -#line 87 "lib/unicase/special-casing-table.gperf" +#line 87 "./unicase/special-casing-table.gperf" {"\037\245\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6D, 0x0399, 0 }, { 0x1FA5, 0, 0 }, { 0x1FAD, 0, 0 }, { 0x1F65, 0x03B9, 0 }}, -#line 86 "lib/unicase/special-casing-table.gperf" +#line 86 "./unicase/special-casing-table.gperf" {"\037\244\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6C, 0x0399, 0 }, { 0x1FA4, 0, 0 }, { 0x1FAC, 0, 0 }, { 0x1F64, 0x03B9, 0 }}, -#line 84 "lib/unicase/special-casing-table.gperf" +#line 84 "./unicase/special-casing-table.gperf" {"\037\242\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F6A, 0x0399, 0 }, { 0x1FA2, 0, 0 }, { 0x1FAA, 0, 0 }, { 0x1F62, 0x03B9, 0 }}, -#line 83 "lib/unicase/special-casing-table.gperf" +#line 83 "./unicase/special-casing-table.gperf" {"\037\241\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F69, 0x0399, 0 }, { 0x1FA1, 0, 0 }, { 0x1FA9, 0, 0 }, { 0x1F61, 0x03B9, 0 }}, -#line 82 "lib/unicase/special-casing-table.gperf" +#line 82 "./unicase/special-casing-table.gperf" {"\037\240\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F68, 0x0399, 0 }, { 0x1FA0, 0, 0 }, { 0x1FA8, 0, 0 }, { 0x1F60, 0x03B9, 0 }}, -#line 81 "lib/unicase/special-casing-table.gperf" +#line 81 "./unicase/special-casing-table.gperf" {"\037\237\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2F, 0x0399, 0 }, { 0x1F97, 0, 0 }, { 0x1F9F, 0, 0 }, { 0x1F27, 0x03B9, 0 }}, -#line 79 "lib/unicase/special-casing-table.gperf" +#line 79 "./unicase/special-casing-table.gperf" {"\037\235\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2D, 0x0399, 0 }, { 0x1F95, 0, 0 }, { 0x1F9D, 0, 0 }, { 0x1F25, 0x03B9, 0 }}, -#line 78 "lib/unicase/special-casing-table.gperf" +#line 78 "./unicase/special-casing-table.gperf" {"\037\234\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2C, 0x0399, 0 }, { 0x1F94, 0, 0 }, { 0x1F9C, 0, 0 }, { 0x1F24, 0x03B9, 0 }}, -#line 77 "lib/unicase/special-casing-table.gperf" +#line 77 "./unicase/special-casing-table.gperf" {"\037\233\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2B, 0x0399, 0 }, { 0x1F93, 0, 0 }, { 0x1F9B, 0, 0 }, { 0x1F23, 0x03B9, 0 }}, -#line 71 "lib/unicase/special-casing-table.gperf" +#line 71 "./unicase/special-casing-table.gperf" {"\037\225\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2D, 0x0399, 0 }, { 0x1F95, 0, 0 }, { 0x1F9D, 0, 0 }, { 0x1F25, 0x03B9, 0 }}, -#line 70 "lib/unicase/special-casing-table.gperf" +#line 70 "./unicase/special-casing-table.gperf" {"\037\224\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2C, 0x0399, 0 }, { 0x1F94, 0, 0 }, { 0x1F9C, 0, 0 }, { 0x1F24, 0x03B9, 0 }}, -#line 69 "lib/unicase/special-casing-table.gperf" +#line 69 "./unicase/special-casing-table.gperf" {"\037\223\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2B, 0x0399, 0 }, { 0x1F93, 0, 0 }, { 0x1F9B, 0, 0 }, { 0x1F23, 0x03B9, 0 }}, -#line 68 "lib/unicase/special-casing-table.gperf" +#line 68 "./unicase/special-casing-table.gperf" {"\037\222\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F2A, 0x0399, 0 }, { 0x1F92, 0, 0 }, { 0x1F9A, 0, 0 }, { 0x1F22, 0x03B9, 0 }}, -#line 67 "lib/unicase/special-casing-table.gperf" +#line 67 "./unicase/special-casing-table.gperf" {"\037\221\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F29, 0x0399, 0 }, { 0x1F91, 0, 0 }, { 0x1F99, 0, 0 }, { 0x1F21, 0x03B9, 0 }}, -#line 65 "lib/unicase/special-casing-table.gperf" +#line 65 "./unicase/special-casing-table.gperf" {"\037\217\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0F, 0x0399, 0 }, { 0x1F87, 0, 0 }, { 0x1F8F, 0, 0 }, { 0x1F07, 0x03B9, 0 }}, -#line 64 "lib/unicase/special-casing-table.gperf" +#line 64 "./unicase/special-casing-table.gperf" {"\037\216\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0E, 0x0399, 0 }, { 0x1F86, 0, 0 }, { 0x1F8E, 0, 0 }, { 0x1F06, 0x03B9, 0 }}, -#line 63 "lib/unicase/special-casing-table.gperf" +#line 63 "./unicase/special-casing-table.gperf" {"\037\215\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0D, 0x0399, 0 }, { 0x1F85, 0, 0 }, { 0x1F8D, 0, 0 }, { 0x1F05, 0x03B9, 0 }}, -#line 62 "lib/unicase/special-casing-table.gperf" +#line 62 "./unicase/special-casing-table.gperf" {"\037\214\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0C, 0x0399, 0 }, { 0x1F84, 0, 0 }, { 0x1F8C, 0, 0 }, { 0x1F04, 0x03B9, 0 }}, -#line 61 "lib/unicase/special-casing-table.gperf" +#line 61 "./unicase/special-casing-table.gperf" {"\037\213\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0B, 0x0399, 0 }, { 0x1F83, 0, 0 }, { 0x1F8B, 0, 0 }, { 0x1F03, 0x03B9, 0 }}, -#line 60 "lib/unicase/special-casing-table.gperf" +#line 60 "./unicase/special-casing-table.gperf" {"\037\212\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0A, 0x0399, 0 }, { 0x1F82, 0, 0 }, { 0x1F8A, 0, 0 }, { 0x1F02, 0x03B9, 0 }}, -#line 59 "lib/unicase/special-casing-table.gperf" +#line 59 "./unicase/special-casing-table.gperf" {"\037\211\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F09, 0x0399, 0 }, { 0x1F81, 0, 0 }, { 0x1F89, 0, 0 }, { 0x1F01, 0x03B9, 0 }}, -#line 58 "lib/unicase/special-casing-table.gperf" +#line 58 "./unicase/special-casing-table.gperf" {"\037\210\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F08, 0x0399, 0 }, { 0x1F80, 0, 0 }, { 0x1F88, 0, 0 }, { 0x1F00, 0x03B9, 0 }}, -#line 56 "lib/unicase/special-casing-table.gperf" +#line 56 "./unicase/special-casing-table.gperf" {"\037\206\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0E, 0x0399, 0 }, { 0x1F86, 0, 0 }, { 0x1F8E, 0, 0 }, { 0x1F06, 0x03B9, 0 }}, -#line 55 "lib/unicase/special-casing-table.gperf" +#line 55 "./unicase/special-casing-table.gperf" {"\037\205\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0D, 0x0399, 0 }, { 0x1F85, 0, 0 }, { 0x1F8D, 0, 0 }, { 0x1F05, 0x03B9, 0 }}, -#line 54 "lib/unicase/special-casing-table.gperf" +#line 54 "./unicase/special-casing-table.gperf" {"\037\204\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0C, 0x0399, 0 }, { 0x1F84, 0, 0 }, { 0x1F8C, 0, 0 }, { 0x1F04, 0x03B9, 0 }}, -#line 53 "lib/unicase/special-casing-table.gperf" +#line 53 "./unicase/special-casing-table.gperf" {"\037\203\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0B, 0x0399, 0 }, { 0x1F83, 0, 0 }, { 0x1F8B, 0, 0 }, { 0x1F03, 0x03B9, 0 }}, -#line 52 "lib/unicase/special-casing-table.gperf" +#line 52 "./unicase/special-casing-table.gperf" {"\037\202\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F0A, 0x0399, 0 }, { 0x1F82, 0, 0 }, { 0x1F8A, 0, 0 }, { 0x1F02, 0x03B9, 0 }}, -#line 51 "lib/unicase/special-casing-table.gperf" +#line 51 "./unicase/special-casing-table.gperf" {"\037\201\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F09, 0x0399, 0 }, { 0x1F81, 0, 0 }, { 0x1F89, 0, 0 }, { 0x1F01, 0x03B9, 0 }}, -#line 50 "lib/unicase/special-casing-table.gperf" +#line 50 "./unicase/special-casing-table.gperf" {"\037\200\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x1F08, 0x0399, 0 }, { 0x1F80, 0, 0 }, { 0x1F88, 0, 0 }, { 0x1F00, 0x03B9, 0 }}, -#line 49 "lib/unicase/special-casing-table.gperf" +#line 49 "./unicase/special-casing-table.gperf" {"\037V\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0313, 0x0342 }, { 0x1F56, 0, 0 }, { 0x03A5, 0x0313, 0x0342 }, { 0x03C5, 0x0313, 0x0342 }}, -#line 48 "lib/unicase/special-casing-table.gperf" +#line 48 "./unicase/special-casing-table.gperf" {"\037T\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0313, 0x0301 }, { 0x1F54, 0, 0 }, { 0x03A5, 0x0313, 0x0301 }, { 0x03C5, 0x0313, 0x0301 }}, -#line 47 "lib/unicase/special-casing-table.gperf" +#line 47 "./unicase/special-casing-table.gperf" {"\037R\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0313, 0x0300 }, { 0x1F52, 0, 0 }, { 0x03A5, 0x0313, 0x0300 }, { 0x03C5, 0x0313, 0x0300 }}, -#line 46 "lib/unicase/special-casing-table.gperf" +#line 46 "./unicase/special-casing-table.gperf" {"\037P\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x03A5, 0x0313, 0 }, { 0x1F50, 0, 0 }, { 0x03A5, 0x0313, 0 }, { 0x03C5, 0x0313, 0 }}, -#line 20 "lib/unicase/special-casing-table.gperf" +#line 20 "./unicase/special-casing-table.gperf" {"\000J\000", 0, SCC_MORE_ABOVE , { 'l', 't' }, { 0x004A, 0, 0 }, { 0x006A, 0x0307, 0 }, { 0x004A, 0, 0 }, { 0x006A, 0, 0 }}, -#line 27 "lib/unicase/special-casing-table.gperf" +#line 27 "./unicase/special-casing-table.gperf" {"\001.\000", 0, SCC_MORE_ABOVE , { 'l', 't' }, { 0x012E, 0, 0 }, { 0x012F, 0x0307, 0 }, { 0x012E, 0, 0 }, { 0x012F, 0, 0 }}, -#line 26 "lib/unicase/special-casing-table.gperf" +#line 26 "./unicase/special-casing-table.gperf" {"\001(\000", 0, SCC_ALWAYS , { 'l', 't' }, { 0x0128, 0, 0 }, { 0x0069, 0x0307, 0x0303 }, { 0x0128, 0, 0 }, { 0x0129, 0, 0 }}, -#line 136 "lib/unicase/special-casing-table.gperf" +#line 136 "./unicase/special-casing-table.gperf" {"\373\027\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0544, 0x053D, 0 }, { 0xFB17, 0, 0 }, { 0x0544, 0x056D, 0 }, { 0x0574, 0x056D, 0 }}, -#line 135 "lib/unicase/special-casing-table.gperf" +#line 135 "./unicase/special-casing-table.gperf" {"\373\026\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x054E, 0x0546, 0 }, { 0xFB16, 0, 0 }, { 0x054E, 0x0576, 0 }, { 0x057E, 0x0576, 0 }}, -#line 134 "lib/unicase/special-casing-table.gperf" +#line 134 "./unicase/special-casing-table.gperf" {"\373\025\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0544, 0x053B, 0 }, { 0xFB15, 0, 0 }, { 0x0544, 0x056B, 0 }, { 0x0574, 0x056B, 0 }}, -#line 133 "lib/unicase/special-casing-table.gperf" +#line 133 "./unicase/special-casing-table.gperf" {"\373\024\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0544, 0x0535, 0 }, { 0xFB14, 0, 0 }, { 0x0544, 0x0565, 0 }, { 0x0574, 0x0565, 0 }}, -#line 132 "lib/unicase/special-casing-table.gperf" +#line 132 "./unicase/special-casing-table.gperf" {"\373\023\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0544, 0x0546, 0 }, { 0xFB13, 0, 0 }, { 0x0544, 0x0576, 0 }, { 0x0574, 0x0576, 0 }}, -#line 131 "lib/unicase/special-casing-table.gperf" +#line 131 "./unicase/special-casing-table.gperf" {"\373\006\000", 0, SCC_ALWAYS , { '\0', '\0' }, { 0x0053, 0x0054, 0 }, { 0xFB06, 0, 0 }, { 0x0053, 0x0074, 0 }, { 0x0073, 0x0074, 0 }} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int key = gl_unicase_special_hash (str, len); + register unsigned int key = gl_unicase_special_hash (str, len); - if (key <= MAX_HASH_VALUE && key >= 0) + if (key <= MAX_HASH_VALUE) if (len == lengthtable[key]) { register const char *s = wordlist[key].code; diff --git a/lib/unicase/special-casing.c b/lib/unicase/special-casing.c index 8186e63..5deee94 100644 --- a/lib/unicase/special-casing.c +++ b/lib/unicase/special-casing.c @@ -1,5 +1,5 @@ /* Special casing table. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,12 +13,12 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ -#include "special-casing.h" +#include "unicase/special-casing.h" #include <string.h> diff --git a/lib/unicase/special-casing.h b/lib/unicase/special-casing.in.h index 1a72acf..9672f97 100644 --- a/lib/unicase/special-casing.h +++ b/lib/unicase/special-casing.in.h @@ -1,5 +1,5 @@ /* Special casing table. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <stddef.h> diff --git a/lib/unicase/tolower.c b/lib/unicase/tolower.c index 866741e..55c5f1c 100644 --- a/lib/unicase/tolower.c +++ b/lib/unicase/tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for Unicode characters (locale and context independent). - Copyright (C) 2002, 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unicase/tolower.h b/lib/unicase/tolower.h index 97ba6ed..6795557 100644 --- a/lib/unicase/tolower.h +++ b/lib/unicase/tolower.h @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Simple character mapping of Unicode characters. */ -/* Generated automatically by gen-uni-tables.c for Unicode 8.0.0. */ +/* Generated automatically by gen-uni-tables.c for Unicode 9.0.0. */ #define mapping_header_0 16 #define mapping_header_1 2 #define mapping_header_2 7 @@ -11,7 +11,7 @@ struct { int level1[2]; short level2[2 << 9]; - int level3[29 << 7]; + int level3[31 << 7]; } u_mapping = { @@ -82,14 +82,12 @@ u_mapping = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3200, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 3328, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, 3456, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, + 3328, 3456, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3584, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 3712, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -141,6 +139,8 @@ u_mapping = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 3840, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -536,7 +536,7 @@ u_mapping = 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, -42308, -42319, -42315, -42305, 0, 0, + 1, 0, -42308, -42319, -42315, -42305, -42308, 0, -42258, -42282, -42261, 928, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -579,6 +579,22 @@ u_mapping = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, @@ -610,6 +626,22 @@ u_mapping = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; diff --git a/lib/unicase/u-casemap.h b/lib/unicase/u-casemap.h index 2ad6b16..adf77ca 100644 --- a/lib/unicase/u-casemap.h +++ b/lib/unicase/u-casemap.h @@ -1,5 +1,5 @@ /* Case mapping for UTF-8/UTF-16/UTF-32 strings (locale dependent). - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ UNIT * FUNC (const UNIT *s, size_t n, diff --git a/lib/unicase/u8-casemap.c b/lib/unicase/u8-casemap.c index 55aaa6a..4562843 100644 --- a/lib/unicase/u8-casemap.c +++ b/lib/unicase/u8-casemap.c @@ -1,5 +1,5 @@ /* Case mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -29,7 +29,7 @@ #include "uninorm.h" #include "caseprop.h" #include "context.h" -#include "special-casing.h" +#include "unicase/special-casing.h" #define FUNC u8_casemap #define UNIT uint8_t diff --git a/lib/unicase/u8-tolower.c b/lib/unicase/u8-tolower.c index 0c2792a..ed7e8de 100644 --- a/lib/unicase/u8-tolower.c +++ b/lib/unicase/u8-tolower.c @@ -1,5 +1,5 @@ /* Lowercase mapping for UTF-8 strings (locale dependent). - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -23,7 +23,7 @@ #include <stddef.h> #include "unicasemap.h" -#include "special-casing.h" +#include "unicase/special-casing.h" uint8_t * u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, diff --git a/lib/unicase/unicasemap.h b/lib/unicase/unicasemap.h index 68fdeba..3b29587 100644 --- a/lib/unicase/unicasemap.h +++ b/lib/unicase/unicasemap.h @@ -1,5 +1,5 @@ /* Case mapping for UTF-8/UTF-16/UTF-32 strings (locale dependent). - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <stddef.h> diff --git a/lib/unictype.in.h b/lib/unictype.in.h index 7fdc304..067cefd 100644 --- a/lib/unictype.in.h +++ b/lib/unictype.in.h @@ -1,5 +1,5 @@ /* Unicode character classification and properties. - Copyright (C) 2002, 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _UNICTYPE_H #define _UNICTYPE_H @@ -551,7 +551,10 @@ enum UC_JOINING_GROUP_MANICHAEAN_FIVE, /* Manichaean_Five */ UC_JOINING_GROUP_MANICHAEAN_TEN, /* Manichaean_Ten */ UC_JOINING_GROUP_MANICHAEAN_TWENTY, /* Manichaean_Twenty */ - UC_JOINING_GROUP_MANICHAEAN_HUNDRED /* Manichaean_Hundred */ + UC_JOINING_GROUP_MANICHAEAN_HUNDRED, /* Manichaean_Hundred */ + UC_JOINING_GROUP_AFRICAN_FEH, /* African_Feh */ + UC_JOINING_GROUP_AFRICAN_QAF, /* African_Qaf */ + UC_JOINING_GROUP_AFRICAN_NOON /* African_Noon */ }; /* Return the name of a joining group. */ diff --git a/lib/unictype/bitmap.h b/lib/unictype/bitmap.h index 475166f..45dbafa 100644 --- a/lib/unictype/bitmap.h +++ b/lib/unictype/bitmap.h @@ -1,5 +1,5 @@ /* Three-level bitmap lookup. - Copyright (C) 2000-2002, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2002, 2005-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2000-2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ static inline int bitmap_lookup (const void *table, ucs4_t uc); diff --git a/lib/unictype/combiningclass.c b/lib/unictype/combiningclass.c index fa90b6e..81b5001 100644 --- a/lib/unictype/combiningclass.c +++ b/lib/unictype/combiningclass.c @@ -1,5 +1,5 @@ /* Combining classes of Unicode characters. - Copyright (C) 2002, 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unictype/combiningclass.h b/lib/unictype/combiningclass.h index 4c91aa6..ddfe9b0 100644 --- a/lib/unictype/combiningclass.h +++ b/lib/unictype/combiningclass.h @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Combining class of Unicode characters. */ -/* Generated automatically by gen-uni-tables.c for Unicode 8.0.0. */ +/* Generated automatically by gen-uni-tables.c for Unicode 9.0.0. */ #define combclass_header_0 16 #define combclass_header_1 2 #define combclass_header_2 7 @@ -11,7 +11,7 @@ struct { int level1[2]; short level2[2 << 9]; - unsigned char level3[72 << 7]; + unsigned char level3[75 << 7]; } u_combclass = { @@ -86,8 +86,9 @@ u_combclass = -1, -1, -1, -1, 6528, 6656, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6784, 6912, 7040, 7168, 7296, 7424, 7552, -1, - -1, 7680, -1, 7808, 7936, 8064, 8192, -1, + 7680, 7808, -1, 7936, 8064, 8192, 8320, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 8064, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -106,8 +107,8 @@ u_combclass = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 8448, 8576, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 8320, 8448, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -127,19 +128,18 @@ u_combclass = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 8704, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 8576, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 8832, 8960, 9088, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 8704, 8832, 8960, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 9216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, 9088, -1, -1, -1, -1, -1, -1, + -1, 9344, 9472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -285,9 +285,9 @@ u_combclass = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 220, 230, 230, 220, 230, + 0, 0, 0, 0, 230, 230, 230, 230, + 230, 230, 230, 230, 230, 230, 230, 230, + 230, 230, 0, 220, 230, 230, 220, 230, 230, 220, 230, 230, 230, 220, 220, 220, 27, 28, 29, 230, 230, 230, 220, 230, 230, 220, 220, 230, 230, 230, 230, 230, @@ -658,7 +658,7 @@ u_combclass = 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 0, 0, - 0, 0, 0, 0, 233, 220, 230, 220, + 0, 0, 0, 230, 233, 220, 230, 220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1115,6 +1115,22 @@ u_combclass = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9, 0, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1283,6 +1299,22 @@ u_combclass = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 230, 230, 230, 230, 230, 230, 230, 0, + 230, 230, 230, 230, 230, 230, 230, 230, + 230, 230, 230, 230, 230, 230, 230, 230, + 230, 0, 0, 230, 230, 230, 230, 230, + 230, 230, 0, 230, 230, 0, 230, 230, + 230, 230, 230, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1298,6 +1330,22 @@ u_combclass = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 230, 230, 230, 230, + 230, 230, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; diff --git a/lib/unictype/pr_soft_dotted.c b/lib/unictype/pr_soft_dotted.c index 3914df1..5fa3c5f 100644 --- a/lib/unictype/pr_soft_dotted.c +++ b/lib/unictype/pr_soft_dotted.c @@ -1,5 +1,5 @@ /* Properties of Unicode characters. - Copyright (C) 2002, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unictype/pr_soft_dotted.h b/lib/unictype/pr_soft_dotted.h index 28f6885..2c81721 100644 --- a/lib/unictype/pr_soft_dotted.h +++ b/lib/unictype/pr_soft_dotted.h @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Properties of Unicode characters. */ -/* Generated automatically by gen-uni-tables.c for Unicode 8.0.0. */ +/* Generated automatically by gen-uni-tables.c for Unicode 9.0.0. */ #define header_0 16 #define header_2 9 #define header_3 127 diff --git a/lib/uninorm.in.h b/lib/uninorm.in.h index 46f14a6..0ac78e0 100644 --- a/lib/uninorm.in.h +++ b/lib/uninorm.in.h @@ -1,5 +1,5 @@ /* Normalization forms (composition and decomposition) of Unicode strings. - Copyright (C) 2001-2002, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _UNINORM_H #define _UNINORM_H diff --git a/lib/uninorm/decompose-internal.c b/lib/uninorm/decompose-internal.c index acf5279..e8448d3 100644 --- a/lib/uninorm/decompose-internal.c +++ b/lib/uninorm/decompose-internal.c @@ -1,5 +1,5 @@ /* Decomposition of Unicode strings. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/uninorm/decompose-internal.h b/lib/uninorm/decompose-internal.h index a5a8634..039bf60 100644 --- a/lib/uninorm/decompose-internal.h +++ b/lib/uninorm/decompose-internal.h @@ -1,5 +1,5 @@ /* Decomposition of Unicode strings. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <stddef.h> diff --git a/lib/uninorm/normalize-internal.h b/lib/uninorm/normalize-internal.h index c31d2a8..ed41695 100644 --- a/lib/uninorm/normalize-internal.h +++ b/lib/uninorm/normalize-internal.h @@ -1,5 +1,5 @@ /* Normalization of Unicode strings. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include "unitypes.h" diff --git a/lib/uninorm/u-normalize-internal.h b/lib/uninorm/u-normalize-internal.h index 060263c..86d5e26 100644 --- a/lib/uninorm/u-normalize-internal.h +++ b/lib/uninorm/u-normalize-internal.h @@ -1,5 +1,5 @@ /* Decomposition and composition of Unicode strings. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ UNIT * FUNC (uninorm_t nf, const UNIT *s, size_t n, diff --git a/lib/uninorm/u8-normalize.c b/lib/uninorm/u8-normalize.c index 375d9f7..abdcac4 100644 --- a/lib/uninorm/u8-normalize.c +++ b/lib/uninorm/u8-normalize.c @@ -1,5 +1,5 @@ /* Normalization of UTF-8 strings. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unistd--.h b/lib/unistd--.h index dd1f068..a6c5266 100644 --- a/lib/unistd--.h +++ b/lib/unistd--.h @@ -1,6 +1,6 @@ /* Like unistd.h, but redefine some names to avoid glitches. - Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/unistd-safer.h b/lib/unistd-safer.h index 7830200..5baf339 100644 --- a/lib/unistd-safer.h +++ b/lib/unistd-safer.h @@ -1,6 +1,6 @@ /* Invoke unistd-like functions, but avoid some glitches. - Copyright (C) 2001, 2003, 2005, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Eric Blake. */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index d5fa34d..ae59cb2 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2003-2017 Free Software Foundation, Inc. + Copyright (C) 2003-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_UNISTD_H @@ -127,11 +127,17 @@ # include <sys/types.h> #endif -/* Get getopt(), optarg, optind, opterr, optopt. - But avoid namespace pollution on glibc systems. */ -#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT -# define __need_getopt -# include <getopt.h> +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Get getopt(), optarg, optind, opterr, optopt. */ +#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT +# include <getopt-cdefs.h> +# include <getopt-pfx-core.h> #endif #ifndef _GL_INLINE_HEADER_BEGIN @@ -142,13 +148,6 @@ _GL_INLINE_HEADER_BEGIN # define _GL_UNISTD_INLINE _GL_INLINE #endif -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - /* Hide some function declarations from <winsock2.h>. */ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ @@ -379,7 +378,7 @@ _GL_WARN_ON_USE (dup2, "dup2 is unportable - " Close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ # if @HAVE_DUP3@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup3 rpl_dup3 @@ -462,13 +461,25 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " #if @GNULIB_FACCESSAT@ -# if !@HAVE_FACCESSAT@ +# if @REPLACE_FACCESSAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef faccessat +# define faccessat rpl_faccessat +# endif +_GL_FUNCDECL_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag)); +# else +# if !@HAVE_FACCESSAT@ _GL_FUNCDECL_SYS (faccessat, int, (int fd, char const *file, int mode, int flag) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (faccessat, int, (int fd, char const *file, int mode, int flag)); +# endif _GL_CXXALIASWARN (faccessat); #elif defined GNULIB_POSIXCHECK # undef faccessat @@ -1149,7 +1160,7 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - " Store the read-end as fd[0] and the write-end as fd[1]. Return 0 upon success, or -1 with errno set upon failure. See also the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ # if @HAVE_PIPE2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define pipe2 rpl_pipe2 @@ -1457,6 +1468,36 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " #endif +#if @GNULIB_TRUNCATE@ +/* Change the size of the file designated by FILENAME to become equal to LENGTH. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + <http://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */ +# if @REPLACE_TRUNCATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef truncate +# define truncate rpl_truncate +# endif +_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); +# else +# if !@HAVE_TRUNCATE@ +_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); +# endif +_GL_CXXALIASWARN (truncate); +#elif defined GNULIB_POSIXCHECK +# undef truncate +# if HAVE_RAW_DECL_TRUNCATE +_GL_WARN_ON_USE (truncate, "truncate is unportable - " + "use gnulib module truncate for portability"); +# endif +#endif + + #if @GNULIB_TTYNAME_R@ /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, otherwise an error number. */ diff --git a/lib/unistr.in.h b/lib/unistr.in.h index 0f330af..b0fbce8 100644 --- a/lib/unistr.in.h +++ b/lib/unistr.in.h @@ -1,5 +1,5 @@ /* Elementary Unicode string functions. - Copyright (C) 2001-2002, 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _UNISTR_H #define _UNISTR_H @@ -137,8 +137,8 @@ extern int The number of available units, N, must be > 0. */ /* Similar to mbtowc(), except that puc and s must not be NULL, n must be > 0, and the NUL character is not treated specially. */ -/* The variants with _safe suffix are safe, even if the library is compiled - without --enable-safety. */ +/* The variants with _unsafe suffix are for backward compatibility with + libunistring versions < 0.9.7. */ #if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING # if !HAVE_INLINE diff --git a/lib/unistr/u-cpy.h b/lib/unistr/u-cpy.h index 4ebdbde..e45b5c9 100644 --- a/lib/unistr/u-cpy.h +++ b/lib/unistr/u-cpy.h @@ -1,5 +1,5 @@ /* Copy piece of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <string.h> diff --git a/lib/unistr/u8-cpy.c b/lib/unistr/u8-cpy.c index 1ef28fa..ba7283e 100644 --- a/lib/unistr/u8-cpy.c +++ b/lib/unistr/u8-cpy.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-8 string. - Copyright (C) 2002, 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unistr/u8-mbtouc-unsafe-aux.c b/lib/unistr/u8-mbtouc-unsafe-aux.c index 5de9786..9b42cb8 100644 --- a/lib/unistr/u8-mbtouc-unsafe-aux.c +++ b/lib/unistr/u8-mbtouc-unsafe-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-8 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unistr/u8-mbtouc-unsafe.c b/lib/unistr/u8-mbtouc-unsafe.c index 06ca679..43cf82f 100644 --- a/lib/unistr/u8-mbtouc-unsafe.c +++ b/lib/unistr/u8-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2002, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unistr/u8-strlen.c b/lib/unistr/u8-strlen.c index bf4dc0e..6d3c09d 100644 --- a/lib/unistr/u8-strlen.c +++ b/lib/unistr/u8-strlen.c @@ -1,5 +1,5 @@ /* Determine length of UTF-8 string. - Copyright (C) 2002, 2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c index 4bfe7fb..dcaa4e8 100644 --- a/lib/unistr/u8-uctomb-aux.c +++ b/lib/unistr/u8-uctomb-aux.c @@ -1,5 +1,5 @@ /* Conversion UCS-4 to UTF-8. - Copyright (C) 2002, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,13 +13,21 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include "unistr.h" +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + int u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n) { @@ -48,9 +56,9 @@ u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n) switch (count) /* note: code falls through cases! */ { case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; - /* fallthrough */ + FALLTHROUGH; case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; - /* fallthrough */ + FALLTHROUGH; case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; /*case 1:*/ s[0] = uc; } diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c index 685b6f1..ec4e904 100644 --- a/lib/unistr/u8-uctomb.c +++ b/lib/unistr/u8-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-8 string. - Copyright (C) 2002, 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h index 8733079..13ed4cb 100644 --- a/lib/unitypes.in.h +++ b/lib/unitypes.in.h @@ -1,5 +1,5 @@ /* Elementary types and macros for the GNU UniString library. - Copyright (C) 2002, 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _UNITYPES_H #define _UNITYPES_H diff --git a/lib/uniwidth.in.h b/lib/uniwidth.in.h index fc85e96..0cacc29 100644 --- a/lib/uniwidth.in.h +++ b/lib/uniwidth.in.h @@ -1,5 +1,5 @@ /* Display width functions. - Copyright (C) 2001-2002, 2005, 2007, 2009-2017 Free Software Foundation, + Copyright (C) 2001-2002, 2005, 2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _UNIWIDTH_H #define _UNIWIDTH_H diff --git a/lib/uniwidth/cjk.h b/lib/uniwidth/cjk.h index c354608..f7f822c 100644 --- a/lib/uniwidth/cjk.h +++ b/lib/uniwidth/cjk.h @@ -1,5 +1,5 @@ /* Test for CJK encoding. - Copyright (C) 2001-2002, 2005-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2007, 2009-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include "streq.h" diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c index 0817d39..cd27d61 100644 --- a/lib/uniwidth/width.c +++ b/lib/uniwidth/width.c @@ -1,5 +1,5 @@ /* Determine display width of Unicode character. - Copyright (C) 2001-2002, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -32,7 +32,7 @@ * - Zero width characters; generated from * "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt" */ -static const unsigned char nonspacing_table_data[36*64] = { +static const unsigned char nonspacing_table_data[38*64] = { /* 0x0000-0x01ff */ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */ @@ -73,7 +73,7 @@ static const unsigned char nonspacing_table_data[36*64] = { 0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */ 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */ - 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, /* 0x08c0-0x08ff */ + 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x08c0-0x08ff */ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */ 0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */ @@ -135,7 +135,7 @@ static const unsigned char nonspacing_table_data[36*64] = { /* 0x1800-0x19ff */ 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */ + 0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */ 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x04, 0x0e, /* 0x1900-0x193f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */ @@ -158,7 +158,7 @@ static const unsigned char nonspacing_table_data[36*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, /* 0x1dc0-0x1dff */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf8, /* 0x1dc0-0x1dff */ /* 0x2000-0x21ff */ 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */ 0x00, 0x00, 0x00, 0x00, 0xdf, 0xff, 0x00, 0x00, /* 0x2040-0x207f */ @@ -199,7 +199,7 @@ static const unsigned char nonspacing_table_data[36*64] = { 0x44, 0x08, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0xa800-0xa83f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */ - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, /* 0xa8c0-0xa8ff */ + 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, /* 0xa8c0-0xa8ff */ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */ 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x13, /* 0xa980-0xa9bf */ @@ -268,7 +268,7 @@ static const unsigned char nonspacing_table_data[36*64] = { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, /* 0x11180-0x111bf */ 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */ /* 0x11200-0x113ff */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd3, 0x00, /* 0x11200-0x1123f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd3, 0x40, /* 0x11200-0x1123f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11240-0x1127f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11280-0x112bf */ 0x00, 0x00, 0x00, 0x80, 0xf8, 0x07, 0x00, 0x00, /* 0x112c0-0x112ff */ @@ -277,8 +277,8 @@ static const unsigned char nonspacing_table_data[36*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11380-0x113bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x113c0-0x113ff */ /* 0x11400-0x115ff */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11400-0x1143f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11440-0x1147f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11400-0x1143f */ + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11440-0x1147f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x85, /* 0x11480-0x114bf */ 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x114c0-0x114ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11500-0x1153f */ @@ -294,6 +294,15 @@ static const unsigned char nonspacing_table_data[36*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11740-0x1177f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11780-0x117bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x117c0-0x117ff */ + /* 0x11c00-0x11dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x3f, /* 0x11c00-0x11c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c40-0x11c7f */ + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xfc, 0x6d, 0x00, /* 0x11c80-0x11cbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11cc0-0x11cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d00-0x11d3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d40-0x11d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d80-0x11dbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11dc0-0x11dff */ /* 0x16a00-0x16bff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a00-0x16a3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a40-0x16a7f */ @@ -348,13 +357,22 @@ static const unsigned char nonspacing_table_data[36*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db40-0x1db7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db80-0x1dbbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dbc0-0x1dbff */ + /* 0x1e000-0x1e1ff */ + 0x7f, 0xff, 0xff, 0xf9, 0xdb, 0x07, 0x00, 0x00, /* 0x1e000-0x1e03f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e040-0x1e07f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e080-0x1e0bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e0c0-0x1e0ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e100-0x1e13f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e140-0x1e17f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e180-0x1e1bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e1c0-0x1e1ff */ /* 0x1e800-0x1e9ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e800-0x1e83f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e840-0x1e87f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e880-0x1e8bf */ 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e8c0-0x1e8ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e900-0x1e93f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */ + 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e980-0x1e9bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1e9c0-0x1e9ff */ }; @@ -376,20 +394,20 @@ static const signed char nonspacing_table_ind[248] = { -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */ -1, -1, -1, -1, -1, 20, -1, 21, /* 0xf000-0xffff */ 22, 23, -1, -1, -1, 24, -1, -1, /* 0x10000-0x10fff */ - 25, 26, 27, 28, -1, -1, -1, -1, /* 0x11000-0x11fff */ + 25, 26, 27, 28, -1, -1, 29, -1, /* 0x11000-0x11fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */ - -1, -1, -1, -1, -1, 29, -1, 30, /* 0x16000-0x16fff */ + -1, -1, -1, -1, -1, 30, -1, 31, /* 0x16000-0x16fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */ - -1, -1, -1, -1, -1, -1, 31, -1, /* 0x1b000-0x1bfff */ + -1, -1, -1, -1, -1, -1, 32, -1, /* 0x1b000-0x1bfff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */ - 32, 33, -1, -1, -1, 34, -1, -1, /* 0x1d000-0x1dfff */ - -1, -1, -1, -1, 35, -1, -1, -1 /* 0x1e000-0x1efff */ + 33, 34, -1, -1, -1, 35, -1, -1, /* 0x1d000-0x1dfff */ + 36, -1, -1, -1, 37, -1, -1, -1 /* 0x1e000-0x1efff */ }; /* Determine number of column positions required for UC. */ diff --git a/lib/unlink.c b/lib/unlink.c index 22427cb..ea1f525 100644 --- a/lib/unlink.c +++ b/lib/unlink.c @@ -1,6 +1,6 @@ /* Work around unlink bugs. - Copyright (C) 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h index aaf60a0..e3f0fcf 100644 --- a/lib/unlocked-io.h +++ b/lib/unlocked-io.h @@ -1,6 +1,6 @@ /* Prefer faster, non-thread-safe stdio functions if available. - Copyright (C) 2001-2004, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/lib/unused-parameter.h b/lib/unused-parameter.h new file mode 100644 index 0000000..40a0ff8 --- /dev/null +++ b/lib/unused-parameter.h @@ -0,0 +1,36 @@ +/* A C macro for declaring that specific function parameters are not used. + Copyright (C) 2008-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter + declarations for parameters that are not used. This helps to reduce + warnings, such as from GCC -Wunused-parameter. The syntax is as follows: + type param _GL_UNUSED_PARAMETER + or more generally + param_decl _GL_UNUSED_PARAMETER + For example: + int param _GL_UNUSED_PARAMETER + int *(*param)(void) _GL_UNUSED_PARAMETER + Other possible, but obscure and discouraged syntaxes: + int _GL_UNUSED_PARAMETER *(*param)(void) + _GL_UNUSED_PARAMETER int *(*param)(void) + */ +#ifndef _GL_UNUSED_PARAMETER +# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__)) +# else +# define _GL_UNUSED_PARAMETER +# endif +#endif diff --git a/lib/utime.c b/lib/utime.c new file mode 100644 index 0000000..80291d3 --- /dev/null +++ b/lib/utime.c @@ -0,0 +1,256 @@ +/* Work around platform bugs in utime. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible. */ + +#include <config.h> + +/* Specification. */ +#include <utime.h> + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +# include <errno.h> +# include <stdbool.h> +# include <windows.h> +# include "filename.h" +# include "malloca.h" + +int +_gl_utimens_windows (const char *name, struct timespec ts[2]) +{ + /* POSIX <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13> + specifies: "More than two leading <slash> characters shall be treated as + a single <slash> character." */ + if (ISSLASH (name[0]) && ISSLASH (name[1]) && ISSLASH (name[2])) + { + name += 2; + while (ISSLASH (name[1])) + name++; + } + + size_t len = strlen (name); + size_t drive_prefix_len = (HAS_DEVICE (name) ? 2 : 0); + + /* Remove trailing slashes (except the very first one, at position + drive_prefix_len), but remember their presence. */ + size_t rlen; + bool check_dir = false; + + rlen = len; + while (rlen > drive_prefix_len && ISSLASH (name[rlen-1])) + { + check_dir = true; + if (rlen == drive_prefix_len + 1) + break; + rlen--; + } + + const char *rname; + char *malloca_rname; + if (rlen == len) + { + rname = name; + malloca_rname = NULL; + } + else + { + malloca_rname = malloca (rlen + 1); + if (malloca_rname == NULL) + { + errno = ENOMEM; + return -1; + } + memcpy (malloca_rname, name, rlen); + malloca_rname[rlen] = '\0'; + rname = malloca_rname; + } + + DWORD error; + + /* Open a handle to the file. + CreateFile + <https://msdn.microsoft.com/en-us/library/aa363858.aspx> + <https://msdn.microsoft.com/en-us/library/aa363874.aspx> */ + HANDLE handle = + CreateFile (rname, + FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only + in case as different) makes sense only when applied to *all* + filesystem operations. */ + FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */, + NULL); + if (handle == INVALID_HANDLE_VALUE) + { + error = GetLastError (); + goto failed; + } + + if (check_dir) + { + /* GetFileAttributes + <https://msdn.microsoft.com/en-us/library/aa364944.aspx> */ + DWORD attributes = GetFileAttributes (rname); + if (attributes == INVALID_FILE_ATTRIBUTES) + { + error = GetLastError (); + CloseHandle (handle); + goto failed; + } + if ((attributes & FILE_ATTRIBUTE_DIRECTORY) == 0) + { + CloseHandle (handle); + if (malloca_rname != NULL) + freea (malloca_rname); + errno = ENOTDIR; + return -1; + } + } + + { + /* Use SetFileTime(). See + <https://msdn.microsoft.com/en-us/library/ms724933.aspx> + <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ + FILETIME last_access_time; + FILETIME last_write_time; + if (ts == NULL) + { + /* GetSystemTimeAsFileTime is the same as + GetSystemTime followed by SystemTimeToFileTime. + <https://msdn.microsoft.com/en-us/library/ms724397.aspx>. + It would be overkill to use + GetSystemTimePreciseAsFileTime + <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. */ + FILETIME current_time; + GetSystemTimeAsFileTime (¤t_time); + last_access_time = current_time; + last_write_time = current_time; + } + else + { + { + ULONGLONG time_since_16010101 = + (ULONGLONG) ts[0].tv_sec * 10000000 + ts[0].tv_nsec / 100 + 116444736000000000LL; + last_access_time.dwLowDateTime = (DWORD) time_since_16010101; + last_access_time.dwHighDateTime = time_since_16010101 >> 32; + } + { + ULONGLONG time_since_16010101 = + (ULONGLONG) ts[1].tv_sec * 10000000 + ts[1].tv_nsec / 100 + 116444736000000000LL; + last_write_time.dwLowDateTime = (DWORD) time_since_16010101; + last_write_time.dwHighDateTime = time_since_16010101 >> 32; + } + } + if (SetFileTime (handle, NULL, &last_access_time, &last_write_time)) + { + CloseHandle (handle); + if (malloca_rname != NULL) + freea (malloca_rname); + return 0; + } + else + { + #if 0 + DWORD sft_error = GetLastError (); + fprintf (stderr, "utimens SetFileTime error 0x%x\n", (unsigned int) sft_error); + #endif + CloseHandle (handle); + if (malloca_rname != NULL) + freea (malloca_rname); + errno = EINVAL; + return -1; + } + } + + failed: + { + #if 0 + fprintf (stderr, "utimens CreateFile/GetFileAttributes error 0x%x\n", (unsigned int) error); + #endif + if (malloca_rname != NULL) + freea (malloca_rname); + + switch (error) + { + /* Some of these errors probably cannot happen with the specific flags + that we pass to CreateFile. But who knows... */ + case ERROR_FILE_NOT_FOUND: /* The last component of rname does not exist. */ + case ERROR_PATH_NOT_FOUND: /* Some directory component in rname does not exist. */ + case ERROR_BAD_PATHNAME: /* rname is such as '\\server'. */ + case ERROR_BAD_NETPATH: /* rname is such as '\\nonexistentserver\share'. */ + case ERROR_BAD_NET_NAME: /* rname is such as '\\server\nonexistentshare'. */ + case ERROR_INVALID_NAME: /* rname contains wildcards, misplaced colon, etc. */ + case ERROR_DIRECTORY: + errno = ENOENT; + break; + + case ERROR_ACCESS_DENIED: /* rname is such as 'C:\System Volume Information\foo'. */ + case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys'. */ + errno = (ts != NULL ? EPERM : EACCES); + break; + + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + + case ERROR_WRITE_PROTECT: + errno = EROFS; + break; + + case ERROR_WRITE_FAULT: + case ERROR_READ_FAULT: + case ERROR_GEN_FAILURE: + errno = EIO; + break; + + case ERROR_BUFFER_OVERFLOW: + case ERROR_FILENAME_EXCED_RANGE: + errno = ENAMETOOLONG; + break; + + case ERROR_DELETE_PENDING: /* XXX map to EACCESS or EPERM? */ + errno = EPERM; + break; + + default: + errno = EINVAL; + break; + } + + return -1; + } +} + +int +utime (const char *name, const struct utimbuf *ts) +{ + if (ts == NULL) + return _gl_utimens_windows (name, NULL); + else + { + struct timespec ts_with_nanoseconds[2]; + ts_with_nanoseconds[0].tv_sec = ts->actime; + ts_with_nanoseconds[0].tv_nsec = 0; + ts_with_nanoseconds[1].tv_sec = ts->modtime; + ts_with_nanoseconds[1].tv_nsec = 0; + return _gl_utimens_windows (name, ts_with_nanoseconds); + } +} + +#endif diff --git a/lib/utime.in.h b/lib/utime.in.h new file mode 100644 index 0000000..8a52a0d --- /dev/null +++ b/lib/utime.in.h @@ -0,0 +1,88 @@ +/* Substitute for and wrapper around <utime.h>. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _@GUARD_PREFIX@_UTIME_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_UTIME_H@ +# @INCLUDE_NEXT@ @NEXT_UTIME_H@ +#endif + +#ifndef _@GUARD_PREFIX@_UTIME_H +#define _@GUARD_PREFIX@_UTIME_H + +#if !@HAVE_UTIME_H@ +# include <sys/utime.h> +#endif + +#if @GNULIB_UTIME@ +/* Get struct timespec. */ +# include <time.h> +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +/* Define 'struct utimbuf' as an alias of 'struct _utimbuf' + (or possibly, if present, 'struct __utimbuf64'). */ +# define utimbuf _utimbuf + +#endif + + +#if @GNULIB_UTIME@ +# if @REPLACE_UTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define utime rpl_utime +# endif +_GL_FUNCDECL_RPL (utime, int, (const char *filename, const struct utimbuf *ts) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (utime, int, (const char *filename, const struct utimbuf *ts)); +# else +# if !@HAVE_UTIME@ +_GL_FUNCDECL_SYS (utime, int, (const char *filename, const struct utimbuf *ts) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (utime, int, (const char *filename, const struct utimbuf *ts)); +# endif +_GL_CXXALIASWARN (utime); +#elif defined GNULIB_POSIXCHECK +# undef utime +# if HAVE_RAW_DECL_UTIME +_GL_WARN_ON_USE (utime, + "utime is unportable - " + "use gnulib module canonicalize-lgpl for portability"); +# endif +#endif + +#if @GNULIB_UTIME@ +extern int _gl_utimens_windows (const char *filename, struct timespec ts[2]); +#endif + + +#endif /* _@GUARD_PREFIX@_UTIME_H */ +#endif /* _@GUARD_PREFIX@_UTIME_H */ diff --git a/lib/utimens.c b/lib/utimens.c index 3643668..c0b0704 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -1,6 +1,6 @@ /* Set file access and modification times. - Copyright (C) 2003-2017 Free Software Foundation, Inc. + Copyright (C) 2003-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -30,22 +30,25 @@ #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> +#include <utime.h> #include "stat-time.h" #include "timespec.h" -#if HAVE_UTIME_H -# include <utime.h> -#endif - -/* Some systems (even some that do have <utime.h>) don't declare this - structure anywhere. */ -#ifndef HAVE_STRUCT_UTIMBUF -struct utimbuf -{ - long actime; - long modtime; -}; +/* On native Windows, use SetFileTime; but avoid this when compiling + GNU Emacs, which arranges for this in some other way and which + defines WIN32_LEAN_AND_MEAN itself. */ + +#if ((defined _WIN32 || defined __WIN32__) \ + && ! defined __CYGWIN__ && ! defined EMACS_CONFIGURATION) +# define USE_SETFILETIME +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif #endif /* Avoid recursion with rpl_futimens or rpl_utimensat. */ @@ -193,7 +196,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) /* Some Linux-based NFS clients are buggy, and mishandle timestamps of files in NFS file systems in some cases. We have no configure-time test for this, but please see - <http://bugs.gentoo.org/show_bug.cgi?id=132673> for references to + <https://bugs.gentoo.org/show_bug.cgi?id=132673> for references to some of the problems with Linux 2.6.16. If this affects you, compile with -DHAVE_BUGGY_NFS_TIME_STAMPS; this is reported to help in some cases, albeit at a cost in performance. But you @@ -247,8 +250,8 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) result = utimensat (AT_FDCWD, file, ts, 0); # ifdef __linux__ /* Work around a kernel bug: - http://bugzilla.redhat.com/442352 - http://bugzilla.redhat.com/449910 + https://bugzilla.redhat.com/show_bug.cgi?id=442352 + https://bugzilla.redhat.com/show_bug.cgi?id=449910 It appears that utimensat can mistakenly return 280 rather than -1 upon ENOSYS failure. FIXME: remove in 2010 or whenever the offending kernels @@ -284,6 +287,90 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) lutimensat_works_really = -1; #endif /* HAVE_UTIMENSAT || HAVE_FUTIMENS */ +#ifdef USE_SETFILETIME + /* On native Windows, use SetFileTime(). See + <https://msdn.microsoft.com/en-us/library/ms724933.aspx> + <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ + if (0 <= fd) + { + HANDLE handle; + FILETIME current_time; + FILETIME last_access_time; + FILETIME last_write_time; + + handle = (HANDLE) _get_osfhandle (fd); + if (handle == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + + if (ts == NULL || ts[0].tv_nsec == UTIME_NOW || ts[1].tv_nsec == UTIME_NOW) + { + /* GetSystemTimeAsFileTime + <https://msdn.microsoft.com/en-us/library/ms724397.aspx>. + It would be overkill to use + GetSystemTimePreciseAsFileTime + <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. */ + GetSystemTimeAsFileTime (¤t_time); + } + + if (ts == NULL || ts[0].tv_nsec == UTIME_NOW) + { + last_access_time = current_time; + } + else if (ts[0].tv_nsec == UTIME_OMIT) + { + last_access_time.dwLowDateTime = 0; + last_access_time.dwHighDateTime = 0; + } + else + { + ULONGLONG time_since_16010101 = + (ULONGLONG) ts[0].tv_sec * 10000000 + ts[0].tv_nsec / 100 + 116444736000000000LL; + last_access_time.dwLowDateTime = (DWORD) time_since_16010101; + last_access_time.dwHighDateTime = time_since_16010101 >> 32; + } + + if (ts == NULL || ts[1].tv_nsec == UTIME_NOW) + { + last_write_time = current_time; + } + else if (ts[1].tv_nsec == UTIME_OMIT) + { + last_write_time.dwLowDateTime = 0; + last_write_time.dwHighDateTime = 0; + } + else + { + ULONGLONG time_since_16010101 = + (ULONGLONG) ts[1].tv_sec * 10000000 + ts[1].tv_nsec / 100 + 116444736000000000LL; + last_write_time.dwLowDateTime = (DWORD) time_since_16010101; + last_write_time.dwHighDateTime = time_since_16010101 >> 32; + } + + if (SetFileTime (handle, NULL, &last_access_time, &last_write_time)) + return 0; + else + { + DWORD sft_error = GetLastError (); + #if 0 + fprintf (stderr, "fdutimens SetFileTime error 0x%x\n", (unsigned int) sft_error); + #endif + switch (sft_error) + { + case ERROR_ACCESS_DENIED: /* fd was opened without O_RDWR */ + errno = EACCES; /* not specified by POSIX */ + break; + default: + errno = EINVAL; + break; + } + return -1; + } + } +#endif + /* The platform lacks an interface to set file timestamps with nanosecond resolution, so do the best we can, discarding any fractional part of the timestamp. */ @@ -390,7 +477,9 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) return -1; } -#if HAVE_WORKING_UTIMES +#ifdef USE_SETFILETIME + return _gl_utimens_windows (file, ts); +#elif HAVE_WORKING_UTIMES return utimes (file, t); #else { @@ -477,8 +566,8 @@ lutimens (char const *file, struct timespec const timespec[2]) result = utimensat (AT_FDCWD, file, ts, AT_SYMLINK_NOFOLLOW); # ifdef __linux__ /* Work around a kernel bug: - http://bugzilla.redhat.com/442352 - http://bugzilla.redhat.com/449910 + https://bugzilla.redhat.com/show_bug.cgi?id=442352 + https://bugzilla.redhat.com/show_bug.cgi?id=449910 It appears that utimensat can mistakenly return 280 rather than -1 upon ENOSYS failure. FIXME: remove in 2010 or whenever the offending kernels diff --git a/lib/utimens.h b/lib/utimens.h index 4d9c18e..a24e62c 100644 --- a/lib/utimens.h +++ b/lib/utimens.h @@ -1,6 +1,6 @@ /* Set file access and modification times. - Copyright 2012-2017 Free Software Foundation, Inc. + Copyright 2012-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index d654689..8b91e3f 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2017 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This file can be parametrized with the following macros: VASNPRINTF The name of the function being defined. @@ -118,6 +118,14 @@ # include "fpucw.h" #endif +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + /* Default parameters. */ #ifndef VASNPRINTF # if WIDE_CHAR_VERSION @@ -156,6 +164,7 @@ # define SNPRINTF snwprintf # else # define SNPRINTF _snwprintf +# define USE_MSVC__SNPRINTF 1 # endif # else /* Unix. */ @@ -181,7 +190,9 @@ /* Here we need to call the native snprintf, not rpl_snprintf. */ # undef snprintf # else + /* MSVC versions < 14 did not have snprintf, only _snprintf. */ # define SNPRINTF _snprintf +# define USE_MSVC__SNPRINTF 1 # endif # else /* Unix. */ @@ -208,7 +219,7 @@ #undef remainder #define remainder rem -#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && !WIDE_CHAR_VERSION +#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && !WIDE_CHAR_VERSION # if (HAVE_STRNLEN && !defined _AIX) # define local_strnlen strnlen # else @@ -224,7 +235,7 @@ local_strnlen (const char *string, size_t maxlen) # endif #endif -#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T +#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T # if HAVE_WCSLEN # define local_wcslen wcslen # else @@ -247,7 +258,7 @@ local_wcslen (const wchar_t *s) # endif #endif -#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99) && HAVE_WCHAR_T && WIDE_CHAR_VERSION +#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION # if HAVE_WCSNLEN # define local_wcsnlen wcsnlen # else @@ -1517,7 +1528,7 @@ is_borderline (const char *digits, size_t precision) #endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF /* Use a different function name, to make it possible that the 'wchar_t' parametrization and the 'char' parametrization get compiled in the same @@ -2392,7 +2403,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } #endif -#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T +#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T else if (dp->conversion == 's' # if WIDE_CHAR_VERSION && a.arg[dp->arg_index].type != TYPE_WIDE_STRING @@ -4591,10 +4602,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int has_width; #endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION size_t width; #endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION int has_precision; size_t precision; #endif @@ -4623,7 +4634,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 0; #endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION width = 0; if (dp->width_start != dp->width_end) { @@ -4657,7 +4668,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } #endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION has_precision = 0; precision = 6; if (dp->precision_start != dp->precision_end) @@ -4834,7 +4845,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, *fbp++ = 'l'; # endif #endif - /*FALLTHROUGH*/ + FALLTHROUGH; case TYPE_LONGINT: case TYPE_ULONGINT: #if HAVE_WINT_T @@ -4858,7 +4869,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #endif *fbp = dp->conversion; #if USE_SNPRINTF -# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) +# if ! (((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \ + && !defined __UCLIBC__) \ + || (defined __APPLE__ && defined __MACH__) \ + || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) fbp[1] = '%'; fbp[2] = 'n'; fbp[3] = '\0'; @@ -4872,6 +4886,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, in format strings in writable memory may crash the program (if compiled with _FORTIFY_SOURCE=2), so we should avoid it in this situation. */ + /* On Mac OS X 10.3 or newer, we know that snprintf's return + value conforms to ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 + and gl_SNPRINTF_TRUNCATION_C99 pass. + Therefore we can avoid using %n in this situation. + On Mac OS X 10.13 or newer, the use of %n in format strings + in writable memory by default crashes the program, so we + should avoid it in this situation. */ /* On native Windows systems (such as mingw), we can avoid using %n because: - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, @@ -4884,8 +4905,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, On native Windows systems (such as mingw) where the OS is Windows Vista, the use of %n in format strings by default crashes the program. See - <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and - <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx> + <https://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and + <https://msdn.microsoft.com/en-us/library/ms175782.aspx> So we should avoid %n in this situation. */ fbp[1] = '\0'; # endif @@ -5127,7 +5148,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Look at the snprintf() return value. */ if (retcount < 0) { -# if !HAVE_SNPRINTF_RETVAL_C99 +# if !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF /* HP-UX 10.20 snprintf() is doubly deficient: It doesn't understand the '%n' directive, *and* it returns -1 (rather than the length diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h index c227825..3eaaa7e 100644 --- a/lib/vasnprintf.h +++ b/lib/vasnprintf.h @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _VASNPRINTF_H #define _VASNPRINTF_H diff --git a/lib/vasprintf.c b/lib/vasprintf.c index 2dd6e3f..aacb306 100644 --- a/lib/vasprintf.c +++ b/lib/vasprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/verify.h b/lib/verify.h index dcba9c8..bc7f99d 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c index 6a19f4c..e11ab6c 100644 --- a/lib/vsnprintf.c +++ b/lib/vsnprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 2004, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2018 Free Software Foundation, Inc. Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/lib/w32sock.h b/lib/w32sock.h index 8ac8ab7..1e5e584 100644 --- a/lib/w32sock.h +++ b/lib/w32sock.h @@ -1,6 +1,6 @@ /* w32sock.h --- internal auxiliary functions for Windows socket functions - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini */ @@ -26,7 +26,11 @@ #include <io.h> /* Get _get_osfhandle(). */ -#include "msvc-nothrow.h" +#if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +#else +# include <io.h> +#endif #define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd))) #define SOCKET_TO_FD(fh) (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY)) diff --git a/lib/w32spawn.h b/lib/w32spawn.h index 7932662..3f675eb 100644 --- a/lib/w32spawn.h +++ b/lib/w32spawn.h @@ -1,5 +1,5 @@ /* Auxiliary functions for the creation of subprocesses. Native Windows API. - Copyright (C) 2001, 2003-2017 Free Software Foundation, Inc. + Copyright (C) 2001, 2003-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef __KLIBC__ /* Get declarations of the native Windows API functions. */ @@ -30,7 +30,11 @@ #include <errno.h> /* Get _get_osfhandle(). */ -#include "msvc-nothrow.h" +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif #include "cloexec.h" #include "xalloc.h" diff --git a/lib/wait-process.c b/lib/wait-process.c index 62b10da..1926bf5 100644 --- a/lib/wait-process.c +++ b/lib/wait-process.c @@ -1,5 +1,5 @@ /* Waiting for a subprocess to finish. - Copyright (C) 2001-2003, 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2018 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -39,14 +39,14 @@ #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) -#if defined _MSC_VER || defined __MINGW32__ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -#define WIN32_LEAN_AND_MEAN -#include <windows.h> +# define WIN32_LEAN_AND_MEAN +# include <windows.h> /* The return value of spawnvp() is really a process handle as returned by CreateProcess(). Therefore we can kill it using TerminateProcess. */ -#define kill(pid,sig) TerminateProcess ((HANDLE) (pid), sig) +# define kill(pid,sig) TerminateProcess ((HANDLE) (pid), sig) #endif diff --git a/lib/wait-process.h b/lib/wait-process.h index 2e99757..0e73e71 100644 --- a/lib/wait-process.h +++ b/lib/wait-process.h @@ -1,5 +1,5 @@ /* Waiting for a subprocess to finish. - Copyright (C) 2001-2003, 2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _WAIT_PROCESS_H #define _WAIT_PROCESS_H diff --git a/lib/waitpid.c b/lib/waitpid.c index 412529f..b2e346a 100644 --- a/lib/waitpid.c +++ b/lib/waitpid.c @@ -1,5 +1,5 @@ /* Wait for process state change. - Copyright (C) 2001-2003, 2005-2017 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h new file mode 100644 index 0000000..e76c384 --- /dev/null +++ b/lib/warn-on-use.h @@ -0,0 +1,109 @@ +/* A C macro for emitting warnings if a function is used. + Copyright (C) 2010-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* _GL_WARN_ON_USE (function, "literal string") issues a declaration + for FUNCTION which will then trigger a compiler warning containing + the text of "literal string" anywhere that function is called, if + supported by the compiler. If the compiler does not support this + feature, the macro expands to an unused extern declaration. + + This macro is useful for marking a function as a potential + portability trap, with the intent that "literal string" include + instructions on the replacement function that should be used + instead. However, one of the reasons that a function is a + portability trap is if it has the wrong signature. Declaring + FUNCTION with a different signature in C is a compilation error, so + this macro must use the same type as any existing declaration so + that programs that avoid the problematic FUNCTION do not fail to + compile merely because they included a header that poisoned the + function. But this implies that _GL_WARN_ON_USE is only safe to + use if FUNCTION is known to already have a declaration. Use of + this macro implies that there must not be any other macro hiding + the declaration of FUNCTION; but undefining FUNCTION first is part + of the poisoning process anyway (although for symbols that are + provided only via a macro, the result is a compilation error rather + than a warning containing "literal string"). Also note that in + C++, it is only safe to use if FUNCTION has no overloads. + + For an example, it is possible to poison 'getline' by: + - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], + [getline]) in configure.ac, which potentially defines + HAVE_RAW_DECL_GETLINE + - adding this code to a header that wraps the system <stdio.h>: + #undef getline + #if HAVE_RAW_DECL_GETLINE + _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" + "not universally present; use the gnulib module getline"); + #endif + + It is not possible to directly poison global variables. But it is + possible to write a wrapper accessor function, and poison that + (less common usage, like &environ, will cause a compilation error + rather than issue the nice warning, but the end result of informing + the developer about their portability problem is still achieved): + #if HAVE_RAW_DECL_ENVIRON + static char ***rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + */ +#ifndef _GL_WARN_ON_USE + +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function __attribute__ ((__warning__ (message))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function +# else /* Unsupported. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +#endif + +/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") + is like _GL_WARN_ON_USE (function, "string"), except that the function is + declared with the given prototype, consisting of return type, parameters, + and attributes. + This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does + not work in this case. */ +#ifndef _GL_WARN_ON_USE_CXX +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern +# endif +#endif diff --git a/lib/wchar.in.h b/lib/wchar.in.h index c8f99f5..51a5dda 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - Copyright (C) 2007-2017 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ @@ -31,7 +31,7 @@ @PRAGMA_COLUMNS@ #if (((defined __need_mbstate_t || defined __need_wint_t) \ - && !defined __MINGW32__ && !defined __KLIBC__) \ + && !defined __MINGW32__) \ || (defined __hpux \ && ((defined _INTTYPES_INCLUDED && !defined strtoimax) \ || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ @@ -113,12 +113,16 @@ # define WEOF -1 # endif #else -/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h>. - This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be - "unchanged by default argument promotions". Override it. */ +/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or + <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that + wint_t must be "unchanged by default argument promotions". Override it. */ # if @GNULIB_OVERRIDES_WINT_T@ # if !GNULIB_defined_wint_t -# include <crtdefs.h> +# if @HAVE_CRTDEFS_H@ +# include <crtdefs.h> +# else +# include <stddef.h> +# endif typedef unsigned int rpl_wint_t; # undef wint_t # define wint_t rpl_wint_t @@ -448,11 +452,6 @@ _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); # if !@HAVE_DECL_WCWIDTH@ /* wcwidth exists but is not declared. */ _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); -# elif defined __KLIBC__ -/* On OS/2 kLIBC, wcwidth is a macro that expands to the name of a - static inline function. The implementation of wcwidth in wcwidth.c - causes a "conflicting types" error. */ -# undef wcwidth # endif _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); # endif @@ -1036,6 +1035,38 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " #endif +/* Convert *TP to a date and time wide string. See + <http://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */ +#if @GNULIB_WCSFTIME@ +# if @REPLACE_WCSFTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcsftime +# define wcsftime rpl_wcsftime +# endif +_GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp) + _GL_ARG_NONNULL ((1, 3, 4))); +_GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp)); +# else +# if !@HAVE_WCSFTIME@ +_GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp) + _GL_ARG_NONNULL ((1, 3, 4))); +# endif +_GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, + const wchar_t *__fmt, const struct tm *__tp)); +# endif +_GL_CXXALIASWARN (wcsftime); +#elif defined GNULIB_POSIXCHECK +# undef wcsftime +# if HAVE_RAW_DECL_WCSFTIME +_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " + "use gnulib module wcsftime for portability"); +# endif +#endif + + #endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif diff --git a/lib/wcrtomb.c b/lib/wcrtomb.c index f956ecf..8f01972 100644 --- a/lib/wcrtomb.c +++ b/lib/wcrtomb.c @@ -1,5 +1,5 @@ /* Convert wide character to multibyte character. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/wctype.in.h b/lib/wctype.in.h index d106cf2..1092016 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. - Copyright (C) 2006-2017 Free Software Foundation, Inc. + Copyright (C) 2006-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible and Paul Eggert. */ @@ -56,11 +56,13 @@ # include <wchar.h> #endif -/* mingw has declarations of towupper and towlower in <ctype.h> as - well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix - being added to the declarations. */ -#ifdef __MINGW32__ +/* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and + isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>. Include + <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the + declarations. */ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # include <ctype.h> +# include <wchar.h> #endif /* Include the original <wctype.h> if it exists. @@ -105,12 +107,16 @@ _GL_INLINE_HEADER_BEGIN # define WEOF -1 # endif #else -/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h>. - This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be - "unchanged by default argument promotions". Override it. */ +/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or + <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that + wint_t must be "unchanged by default argument promotions". Override it. */ # if @GNULIB_OVERRIDES_WINT_T@ # if !GNULIB_defined_wint_t -# include <crtdefs.h> +# if @HAVE_CRTDEFS_H@ +# include <crtdefs.h> +# else +# include <stddef.h> +# endif typedef unsigned int rpl_wint_t; # undef wint_t # define wint_t rpl_wint_t diff --git a/lib/wcwidth.c b/lib/wcwidth.c index 038e865..5fb090e 100644 --- a/lib/wcwidth.c +++ b/lib/wcwidth.c @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a character. - Copyright (C) 2006-2007, 2010-2017 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2010-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/write.c b/lib/write.c index 6a3b623..92b36ad 100644 --- a/lib/write.c +++ b/lib/write.c @@ -1,5 +1,5 @@ /* POSIX compatible write() function. - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> @@ -34,8 +34,14 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> -# include "msvc-inval.h" -# include "msvc-nothrow.h" +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include <io.h> +# endif # undef write diff --git a/lib/xalloc-die.c b/lib/xalloc-die.c index 3a64aa5..bfe6109 100644 --- a/lib/xalloc-die.c +++ b/lib/xalloc-die.c @@ -1,6 +1,6 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2017 Free Software + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index ff0efc6..3426e10 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h @@ -1,6 +1,6 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef XALLOC_OVERSIZED_H_ #define XALLOC_OVERSIZED_H_ @@ -44,7 +44,7 @@ typedef size_t __xalloc_count_type; #if 7 <= __GNUC__ # define xalloc_oversized(n, s) \ __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) -#elif 5 <= __GNUC__ && !__STRICT_ANSI__ +#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ # define xalloc_oversized(n, s) \ (__builtin_constant_p (n) && __builtin_constant_p (s) \ ? __xalloc_oversized (n, s) \ diff --git a/lib/xalloc.h b/lib/xalloc.h index 484b67f..2a51b84 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -1,6 +1,6 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990-2000, 2003-2004, 2006-2017 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef XALLOC_H_ #define XALLOC_H_ @@ -194,6 +194,8 @@ x2nrealloc (void *p, size_t *pn, size_t s) n = DEFAULT_MXFAST / s; n += !n; } + if (xalloc_oversized (n, s)) + xalloc_die (); } else { diff --git a/lib/xmalloc.c b/lib/xmalloc.c index a4d308d..9a30d67 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -1,6 +1,6 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-2000, 2002-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/xmemdup0.c b/lib/xmemdup0.c index f198be4..1b53d11 100644 --- a/lib/xmemdup0.c +++ b/lib/xmemdup0.c @@ -1,6 +1,6 @@ /* xmemdup0.c -- copy a block of arbitrary bytes, plus a trailing NUL - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/xmemdup0.h b/lib/xmemdup0.h index ed4b980..d182028 100644 --- a/lib/xmemdup0.h +++ b/lib/xmemdup0.h @@ -1,6 +1,6 @@ /* xmemdup0.h -- copy a block of arbitrary bytes, plus a trailing NUL - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef XMEMDUP_H_ # define XMEMDUP_H_ diff --git a/lib/xsize.h b/lib/xsize.h index daf78d6..8aeb3b7 100644 --- a/lib/xsize.h +++ b/lib/xsize.h @@ -1,6 +1,6 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2003, 2008-2018 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _XSIZE_H #define _XSIZE_H diff --git a/lib/xstrndup.c b/lib/xstrndup.c index 8fbef7f..3b1700a 100644 --- a/lib/xstrndup.c +++ b/lib/xstrndup.c @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2006-2007, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/xstrndup.h b/lib/xstrndup.h index d901c2c..0a4420d 100644 --- a/lib/xstrndup.h +++ b/lib/xstrndup.h @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2009-2017 Free Software Foundation, Inc. + Copyright (C) 2003, 2009-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <stddef.h> |