summaryrefslogtreecommitdiff
path: root/gnulib
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2007-12-13 11:42:58 +0000
committerColin Watson <cjwatson@debian.org>2007-12-13 11:42:58 +0000
commit0db8e00bc174da48bb5ba50d0262f8c9603e89f7 (patch)
treed1badc7abaa7f779445312aac365ed78fd839b3b /gnulib
parent2eb9bd79c5f56303ea3c47ee87b8c79d8c0bc37c (diff)
parent4ff30791b6fe2c2a13c1d5a77a17013e7a931317 (diff)
merge from trunk
Diffstat (limited to 'gnulib')
-rw-r--r--gnulib/lib/Makefile.am366
-rw-r--r--gnulib/lib/Makefile.in322
-rw-r--r--gnulib/lib/alloca.c2
-rw-r--r--gnulib/lib/alloca.in.h (renamed from gnulib/lib/alloca_.h)2
-rw-r--r--gnulib/lib/areadlink-with-size.c10
-rw-r--r--gnulib/lib/areadlink.h10
-rw-r--r--gnulib/lib/argp-ba.c11
-rw-r--r--gnulib/lib/argp-eexst.c11
-rw-r--r--gnulib/lib/argp-fmtstream.c11
-rw-r--r--gnulib/lib/argp-fmtstream.h40
-rw-r--r--gnulib/lib/argp-fs-xinl.c11
-rw-r--r--gnulib/lib/argp-help.c11
-rw-r--r--gnulib/lib/argp-namefrob.h11
-rw-r--r--gnulib/lib/argp-parse.c11
-rw-r--r--gnulib/lib/argp-pin.c11
-rw-r--r--gnulib/lib/argp-pv.c11
-rw-r--r--gnulib/lib/argp-pvh.c11
-rw-r--r--gnulib/lib/argp-xinl.c11
-rw-r--r--gnulib/lib/argp.h38
-rw-r--r--gnulib/lib/asnprintf.c2
-rw-r--r--gnulib/lib/asprintf.c2
-rw-r--r--gnulib/lib/at-func.c85
-rw-r--r--gnulib/lib/basename.c9
-rw-r--r--gnulib/lib/canonicalize-lgpl.c362
-rw-r--r--gnulib/lib/canonicalize.c50
-rw-r--r--gnulib/lib/canonicalize.h10
-rw-r--r--gnulib/lib/chdir-long.c264
-rw-r--r--gnulib/lib/chdir-long.h34
-rw-r--r--gnulib/lib/chown.c103
-rwxr-xr-xgnulib/lib/config.charset36
-rw-r--r--gnulib/lib/creat-safer.c31
-rw-r--r--gnulib/lib/cycle-check.c87
-rw-r--r--gnulib/lib/cycle-check.h54
-rw-r--r--gnulib/lib/dev-ino.h13
-rw-r--r--gnulib/lib/dirent.in.h45
-rw-r--r--gnulib/lib/dirfd.c9
-rw-r--r--gnulib/lib/dirfd.h9
-rw-r--r--gnulib/lib/dirname.c9
-rw-r--r--gnulib/lib/dirname.h9
-rw-r--r--gnulib/lib/dup-safer.c44
-rw-r--r--gnulib/lib/dup2.c57
-rw-r--r--gnulib/lib/error.c11
-rw-r--r--gnulib/lib/error.h11
-rw-r--r--gnulib/lib/exitfail.c10
-rw-r--r--gnulib/lib/exitfail.h10
-rw-r--r--gnulib/lib/fchdir.c282
-rw-r--r--gnulib/lib/fchmodat.c49
-rw-r--r--gnulib/lib/fchown-stub.c16
-rw-r--r--gnulib/lib/fchownat.c48
-rw-r--r--gnulib/lib/fcntl--.h27
-rw-r--r--gnulib/lib/fcntl-safer.h23
-rw-r--r--gnulib/lib/fcntl.in.h120
-rw-r--r--gnulib/lib/fd-safer.c56
-rw-r--r--gnulib/lib/file-set.c74
-rw-r--r--gnulib/lib/file-set.h12
-rw-r--r--gnulib/lib/filenamecat.c46
-rw-r--r--gnulib/lib/filenamecat.h9
-rw-r--r--gnulib/lib/float+.h2
-rw-r--r--gnulib/lib/float.in.h (renamed from gnulib/lib/float_.h)9
-rw-r--r--gnulib/lib/fnmatch.c2
-rw-r--r--gnulib/lib/fnmatch.in.h (renamed from gnulib/lib/fnmatch_.h)2
-rw-r--r--gnulib/lib/fnmatch_loop.c2
-rw-r--r--gnulib/lib/fstatat.c56
-rw-r--r--gnulib/lib/getcwd.c13
-rw-r--r--gnulib/lib/getlogin_r.c4
-rw-r--r--gnulib/lib/getopt.c11
-rw-r--r--gnulib/lib/getopt.in.h (renamed from gnulib/lib/getopt_.h)11
-rw-r--r--gnulib/lib/getopt1.c11
-rw-r--r--gnulib/lib/getopt_int.h11
-rw-r--r--gnulib/lib/gettext.h2
-rw-r--r--gnulib/lib/gettimeofday.c8
-rw-r--r--gnulib/lib/glob-libc.h6
-rw-r--r--gnulib/lib/glob.c616
-rw-r--r--gnulib/lib/glob.in.h (renamed from gnulib/lib/glob_.h)4
-rw-r--r--gnulib/lib/hash-pjw.c40
-rw-r--r--gnulib/lib/hash-pjw.h23
-rw-r--r--gnulib/lib/hash-triple.c77
-rw-r--r--gnulib/lib/hash-triple.h22
-rw-r--r--gnulib/lib/hash.c1049
-rw-r--r--gnulib/lib/hash.h87
-rw-r--r--gnulib/lib/intprops.h77
-rw-r--r--gnulib/lib/lchown.c62
-rw-r--r--gnulib/lib/localcharset.c2
-rw-r--r--gnulib/lib/localcharset.h2
-rw-r--r--gnulib/lib/lock.c23
-rw-r--r--gnulib/lib/lock.h385
-rw-r--r--gnulib/lib/lstat.c75
-rw-r--r--gnulib/lib/lstat.h23
-rw-r--r--gnulib/lib/malloc.c2
-rw-r--r--gnulib/lib/malloca.c2
-rw-r--r--gnulib/lib/malloca.h2
-rw-r--r--gnulib/lib/memcmp.c8
-rw-r--r--gnulib/lib/mempcpy.c2
-rw-r--r--gnulib/lib/memrchr.c189
-rw-r--r--gnulib/lib/minmax.h2
-rw-r--r--gnulib/lib/mkdirat.c42
-rw-r--r--gnulib/lib/mkdtemp.c11
-rw-r--r--gnulib/lib/mkstemp.c11
-rw-r--r--gnulib/lib/open-safer.c49
-rw-r--r--gnulib/lib/openat-die.c50
-rw-r--r--gnulib/lib/openat-priv.h54
-rw-r--r--gnulib/lib/openat-proc.c94
-rw-r--r--gnulib/lib/openat.c268
-rw-r--r--gnulib/lib/openat.h126
-rw-r--r--gnulib/lib/pathmax.h2
-rw-r--r--gnulib/lib/pipe-safer.c56
-rw-r--r--gnulib/lib/printf-args.c2
-rw-r--r--gnulib/lib/printf-args.h2
-rw-r--r--gnulib/lib/printf-parse.c27
-rw-r--r--gnulib/lib/printf-parse.h2
-rw-r--r--gnulib/lib/readlink.c9
-rw-r--r--gnulib/lib/ref-add.sin2
-rw-r--r--gnulib/lib/ref-del.sin2
-rw-r--r--gnulib/lib/regcomp.c4
-rw-r--r--gnulib/lib/regex.c2
-rw-r--r--gnulib/lib/regex.h2
-rw-r--r--gnulib/lib/regex_internal.c2
-rw-r--r--gnulib/lib/regex_internal.h2
-rw-r--r--gnulib/lib/regexec.c2
-rw-r--r--gnulib/lib/rename.c9
-rw-r--r--gnulib/lib/same-inode.h9
-rw-r--r--gnulib/lib/same.c125
-rw-r--r--gnulib/lib/same.h26
-rw-r--r--gnulib/lib/save-cwd.c102
-rw-r--r--gnulib/lib/save-cwd.h33
-rw-r--r--gnulib/lib/setenv.c11
-rw-r--r--gnulib/lib/setenv.h9
-rw-r--r--gnulib/lib/size_max.h2
-rw-r--r--gnulib/lib/sleep.c9
-rw-r--r--gnulib/lib/stdbool.in.h (renamed from gnulib/lib/stdbool_.h)9
-rw-r--r--gnulib/lib/stdint.in.h (renamed from gnulib/lib/stdint_.h)12
-rw-r--r--gnulib/lib/stdio.in.h (renamed from gnulib/lib/stdio_.h)55
-rw-r--r--gnulib/lib/stdlib.in.h (renamed from gnulib/lib/stdlib_.h)18
-rw-r--r--gnulib/lib/strcasecmp.c2
-rw-r--r--gnulib/lib/strchrnul.c9
-rw-r--r--gnulib/lib/strcspn.c7
-rw-r--r--gnulib/lib/strdup.c2
-rw-r--r--gnulib/lib/strerror.c54
-rw-r--r--gnulib/lib/string.in.h (renamed from gnulib/lib/string_.h)62
-rw-r--r--gnulib/lib/strings.in.h86
-rw-r--r--gnulib/lib/stripslash.c9
-rw-r--r--gnulib/lib/strncasecmp.c2
-rw-r--r--gnulib/lib/strndup.c2
-rw-r--r--gnulib/lib/strnlen.c2
-rw-r--r--gnulib/lib/strpbrk.c2
-rw-r--r--gnulib/lib/strsep.c2
-rw-r--r--gnulib/lib/sys_select.in.h (renamed from gnulib/lib/sys_select_.h)2
-rw-r--r--gnulib/lib/sys_socket.in.h (renamed from gnulib/lib/sys_socket_.h)2
-rw-r--r--gnulib/lib/sys_stat.in.h (renamed from gnulib/lib/sys_stat_.h)2
-rw-r--r--gnulib/lib/sys_time.in.h (renamed from gnulib/lib/sys_time_.h)2
-rw-r--r--gnulib/lib/sysexits.in.h (renamed from gnulib/lib/sysexits_.h)9
-rw-r--r--gnulib/lib/tempname.c11
-rw-r--r--gnulib/lib/tempname.h9
-rw-r--r--gnulib/lib/unistd--.h27
-rw-r--r--gnulib/lib/unistd-safer.h22
-rw-r--r--gnulib/lib/unistd.in.h (renamed from gnulib/lib/unistd_.h)57
-rw-r--r--gnulib/lib/unsetenv.c11
-rw-r--r--gnulib/lib/vasnprintf.c927
-rw-r--r--gnulib/lib/vasnprintf.h2
-rw-r--r--gnulib/lib/vasprintf.c2
-rw-r--r--gnulib/lib/vsnprintf.c2
-rw-r--r--gnulib/lib/wchar.in.h (renamed from gnulib/lib/wchar_.h)2
-rw-r--r--gnulib/lib/wctype.in.h (renamed from gnulib/lib/wctype_.h)2
-rw-r--r--gnulib/lib/xalloc-die.c9
-rw-r--r--gnulib/lib/xalloc.h9
-rw-r--r--gnulib/lib/xasprintf.c11
-rw-r--r--gnulib/lib/xgetcwd.c9
-rw-r--r--gnulib/lib/xgetcwd.h9
-rw-r--r--gnulib/lib/xmalloc.c9
-rw-r--r--gnulib/lib/xmalloc.c.orig122
-rw-r--r--gnulib/lib/xsize.h2
-rw-r--r--gnulib/lib/xstrndup.c9
-rw-r--r--gnulib/lib/xstrndup.h9
-rw-r--r--gnulib/lib/xvasprintf.c11
-rw-r--r--gnulib/lib/xvasprintf.h11
-rw-r--r--gnulib/m4/canonicalize-lgpl.m435
-rw-r--r--gnulib/m4/chdir-long.m438
-rw-r--r--gnulib/m4/chown.m483
-rw-r--r--gnulib/m4/d-type.m48
-rw-r--r--gnulib/m4/dup2.m415
-rw-r--r--gnulib/m4/fchdir.m426
-rw-r--r--gnulib/m4/fcntl-safer.m4 (renamed from gnulib/m4/cycle-check.m4)8
-rw-r--r--gnulib/m4/fcntl_h.m494
-rw-r--r--gnulib/m4/gnulib-common.m445
-rw-r--r--gnulib/m4/gnulib-comp.m4167
-rw-r--r--gnulib/m4/hash.m413
-rw-r--r--gnulib/m4/intmax_t.m412
-rw-r--r--gnulib/m4/lchown.m422
-rw-r--r--gnulib/m4/lib-link.m42
-rw-r--r--gnulib/m4/lock.m42
-rw-r--r--gnulib/m4/longlong.m478
-rw-r--r--gnulib/m4/lstat.m417
-rw-r--r--gnulib/m4/mempcpy.m44
-rw-r--r--gnulib/m4/memrchr.m425
-rw-r--r--gnulib/m4/openat.m490
-rw-r--r--gnulib/m4/pathmax.m411
-rw-r--r--gnulib/m4/same.m414
-rw-r--r--gnulib/m4/save-cwd.m412
-rw-r--r--gnulib/m4/stdint.m44
-rw-r--r--gnulib/m4/stdio_h.m422
-rw-r--r--gnulib/m4/stdlib_h.m44
-rw-r--r--gnulib/m4/strerror.m434
-rw-r--r--gnulib/m4/string_h.m45
-rw-r--r--gnulib/m4/strings_h.m433
-rw-r--r--gnulib/m4/strsep.m44
-rw-r--r--gnulib/m4/ulonglong.m448
-rw-r--r--gnulib/m4/unistd-safer.m413
-rw-r--r--gnulib/m4/unistd_h.m46
-rw-r--r--gnulib/m4/vasnprintf.m452
-rw-r--r--gnulib/m4/wint_t.m42
210 files changed, 8449 insertions, 1366 deletions
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
index f34e2dfd..49095f13 100644
--- a/gnulib/lib/Makefile.am
+++ b/gnulib/lib/Makefile.am
@@ -62,14 +62,14 @@ BUILT_SOURCES += $(ALLOCA_H)
# We need the following in order to create <alloca.h> when the system
# doesn't have one that works with the given compiler.
-alloca.h: alloca_.h
+alloca.h: alloca.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/alloca_.h; \
+ cat $(srcdir)/alloca.in.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += alloca.h alloca.h-t
-EXTRA_DIST += alloca_.h
+EXTRA_DIST += alloca.in.h
## end gnulib module alloca-opt
@@ -112,6 +112,33 @@ EXTRA_libgnu_a_SOURCES += canonicalize.c
## end gnulib module canonicalize
+## begin gnulib module canonicalize-lgpl
+
+
+EXTRA_DIST += canonicalize-lgpl.c canonicalize.h
+
+EXTRA_libgnu_a_SOURCES += canonicalize-lgpl.c
+
+## end gnulib module canonicalize-lgpl
+
+## begin gnulib module chdir-long
+
+
+EXTRA_DIST += chdir-long.c chdir-long.h
+
+EXTRA_libgnu_a_SOURCES += chdir-long.c
+
+## end gnulib module chdir-long
+
+## begin gnulib module chown
+
+
+EXTRA_DIST += chown.c fchown-stub.c
+
+EXTRA_libgnu_a_SOURCES += chown.c fchown-stub.c
+
+## end gnulib module chown
+
## begin gnulib module configmake
# Retrieve values of the variables through 'configure' followed by
@@ -168,22 +195,6 @@ CLEANFILES += configmake.h configmake.h-t
## end gnulib module configmake
-## begin gnulib module cycle-check
-
-
-EXTRA_DIST += cycle-check.c cycle-check.h
-
-EXTRA_libgnu_a_SOURCES += cycle-check.c
-
-## end gnulib module cycle-check
-
-## begin gnulib module dev-ino
-
-
-EXTRA_DIST += dev-ino.h
-
-## end gnulib module dev-ino
-
## begin gnulib module dirfd
@@ -202,6 +213,15 @@ EXTRA_libgnu_a_SOURCES += basename.c dirname.c stripslash.c
## end gnulib module dirname
+## begin gnulib module dup2
+
+
+EXTRA_DIST += dup2.c
+
+EXTRA_libgnu_a_SOURCES += dup2.c
+
+## end gnulib module dup2
+
## begin gnulib module error
@@ -220,6 +240,68 @@ EXTRA_libgnu_a_SOURCES += exitfail.c
## end gnulib module exitfail
+## begin gnulib module fchdir
+
+BUILT_SOURCES += $(DIRENT_H)
+
+# We need the following in order to create <dirent.h> when the system
+# doesn't have one that works with the given compiler.
+dirent.h: dirent.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
+ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+ < $(srcdir)/dirent.in.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += dirent.h dirent.h-t
+
+EXTRA_DIST += dirent.in.h fchdir.c
+
+EXTRA_libgnu_a_SOURCES += fchdir.c
+
+## end gnulib module fchdir
+
+## begin gnulib module fcntl
+
+BUILT_SOURCES += $(FCNTL_H)
+
+# We need the following in order to create <fcntl.h> when the system
+# doesn't have one that works with the given compiler.
+fcntl.h: fcntl.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+ -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
+ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
+ < $(srcdir)/fcntl.in.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += fcntl.h fcntl.h-t
+
+EXTRA_DIST += fcntl.in.h
+
+## end gnulib module fcntl
+
+## begin gnulib module fcntl-safer
+
+
+EXTRA_DIST += creat-safer.c fcntl--.h fcntl-safer.h open-safer.c
+
+EXTRA_libgnu_a_SOURCES += creat-safer.c open-safer.c
+
+## end gnulib module fcntl-safer
+
+## begin gnulib module file-set
+
+libgnu_a_SOURCES += file-set.c
+
+EXTRA_DIST += file-set.h
+
+## end gnulib module file-set
+
## begin gnulib module filenamecat
@@ -235,17 +317,17 @@ BUILT_SOURCES += $(FLOAT_H)
# We need the following in order to create <float.h> when the system
# doesn't have one that works with the given compiler.
-float.h: float_.h
+float.h: float.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
- < $(srcdir)/float_.h; \
+ < $(srcdir)/float.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += float.h float.h-t
-EXTRA_DIST += float_.h
+EXTRA_DIST += float.in.h
## end gnulib module float
@@ -255,14 +337,14 @@ BUILT_SOURCES += $(FNMATCH_H)
# We need the following in order to create <fnmatch.h> when the system
# doesn't have one that supports the required API.
-fnmatch.h: fnmatch_.h
+fnmatch.h: fnmatch.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/fnmatch_.h; \
+ cat $(srcdir)/fnmatch.in.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
-EXTRA_DIST += fnmatch.c fnmatch_.h fnmatch_loop.c
+EXTRA_DIST += fnmatch.c fnmatch.in.h fnmatch_loop.c
EXTRA_libgnu_a_SOURCES += fnmatch.c fnmatch_loop.c
@@ -292,14 +374,14 @@ BUILT_SOURCES += $(GETOPT_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_.h
+getopt.h: getopt.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/getopt_.h; \
+ cat $(srcdir)/getopt.in.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += getopt.h getopt.h-t
-EXTRA_DIST += getopt.c getopt1.c getopt_.h getopt_int.h
+EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h
EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c
@@ -326,20 +408,43 @@ BUILT_SOURCES += $(GLOB_H)
# We need the following in order to create <glob.h> when the system
# doesn't have one that works with the given compiler.
-glob.h: glob_.h
+glob.h: glob.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
- < $(srcdir)/glob_.h; \
+ < $(srcdir)/glob.in.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += glob.h glob.h-t
-EXTRA_DIST += glob-libc.h glob.c glob_.h
+EXTRA_DIST += glob-libc.h glob.c glob.in.h
EXTRA_libgnu_a_SOURCES += glob.c
## end gnulib module glob
+## begin gnulib module hash
+
+
+EXTRA_DIST += hash.c hash.h
+
+EXTRA_libgnu_a_SOURCES += hash.c
+
+## end gnulib module hash
+
+## begin gnulib module hash-pjw
+
+libgnu_a_SOURCES += hash-pjw.h hash-pjw.c
+
+## end gnulib module hash-pjw
+
+## begin gnulib module hash-triple
+
+libgnu_a_SOURCES += hash-triple.c
+
+EXTRA_DIST += hash-triple.h
+
+## end gnulib module hash-triple
+
## begin gnulib module havelib
@@ -347,6 +452,22 @@ EXTRA_DIST += $(top_srcdir)/tools/config.rpath
## end gnulib module havelib
+## begin gnulib module intprops
+
+
+EXTRA_DIST += intprops.h
+
+## end gnulib module intprops
+
+## begin gnulib module lchown
+
+
+EXTRA_DIST += lchown.c
+
+EXTRA_libgnu_a_SOURCES += lchown.c
+
+## end gnulib module lchown
+
## begin gnulib module link-warning
LINK_WARNING_H=$(top_srcdir)/tools/link-warning.h
@@ -421,6 +542,15 @@ EXTRA_DIST += $(top_srcdir)/tools/config.rpath
## end gnulib module lock
+## begin gnulib module lstat
+
+
+EXTRA_DIST += lstat.c lstat.h
+
+EXTRA_libgnu_a_SOURCES += lstat.c
+
+## end gnulib module lstat
+
## begin gnulib module malloc
@@ -465,6 +595,15 @@ EXTRA_libgnu_a_SOURCES += mempcpy.c
## end gnulib module mempcpy
+## begin gnulib module memrchr
+
+
+EXTRA_DIST += memrchr.c
+
+EXTRA_libgnu_a_SOURCES += memrchr.c
+
+## end gnulib module memrchr
+
## begin gnulib module minmax
libgnu_a_SOURCES += minmax.h
@@ -489,6 +628,28 @@ EXTRA_libgnu_a_SOURCES += mkstemp.c
## end gnulib module mkstemp
+## begin gnulib module openat
+
+
+EXTRA_DIST += at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c openat-priv.h openat-proc.c openat.c openat.h
+
+EXTRA_libgnu_a_SOURCES += at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c openat-proc.c openat.c
+
+## end gnulib module openat
+
+## begin gnulib module openat-die
+
+libgnu_a_SOURCES += openat-die.c
+
+## end gnulib module openat-die
+
+## begin gnulib module pathmax
+
+
+EXTRA_DIST += pathmax.h
+
+## end gnulib module pathmax
+
## begin gnulib module readlink
@@ -516,6 +677,15 @@ EXTRA_libgnu_a_SOURCES += rename.c
## end gnulib module rename
+## begin gnulib module same
+
+
+EXTRA_DIST += same.c same.h
+
+EXTRA_libgnu_a_SOURCES += same.c
+
+## end gnulib module same
+
## begin gnulib module same-inode
@@ -523,6 +693,15 @@ EXTRA_DIST += same-inode.h
## end gnulib module same-inode
+## begin gnulib module save-cwd
+
+
+EXTRA_DIST += save-cwd.c save-cwd.h
+
+EXTRA_libgnu_a_SOURCES += save-cwd.c
+
+## end gnulib module save-cwd
+
## begin gnulib module setenv
@@ -553,15 +732,15 @@ BUILT_SOURCES += $(STDBOOL_H)
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
-stdbool.h: stdbool_.h
+stdbool.h: stdbool.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
+ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
-EXTRA_DIST += stdbool_.h
+EXTRA_DIST += stdbool.in.h
## end gnulib module stdbool
@@ -571,7 +750,7 @@ BUILT_SOURCES += $(STDINT_H)
# We need the following in order to create <stdint.h> when the system
# doesn't have one that works with the given compiler.
-stdint.h: stdint_.h
+stdint.h: stdint.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
@@ -596,12 +775,12 @@ stdint.h: stdint_.h
-e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
-e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
-e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
- < $(srcdir)/stdint_.h; \
+ < $(srcdir)/stdint.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdint.h stdint.h-t
-EXTRA_DIST += stdint_.h
+EXTRA_DIST += stdint.in.h
## end gnulib module stdint
@@ -611,7 +790,7 @@ BUILT_SOURCES += stdio.h
# We need the following in order to create <stdio.h> when the system
# doesn't have one that works with the given compiler.
-stdio.h: stdio_.h
+stdio.h: stdio.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -625,6 +804,8 @@ stdio.h: stdio_.h
-e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
-e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+ -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
+ -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
-e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
-e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
-e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
@@ -644,6 +825,8 @@ stdio.h: stdio_.h
-e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
+ -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
-e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
-e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
@@ -653,12 +836,12 @@ stdio.h: stdio_.h
-e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
-e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/stdio_.h; \
+ < $(srcdir)/stdio.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdio.h stdio.h-t
-EXTRA_DIST += stdio_.h
+EXTRA_DIST += stdio.in.h
## end gnulib module stdio
@@ -668,7 +851,7 @@ BUILT_SOURCES += stdlib.h
# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
-stdlib.h: stdlib_.h
+stdlib.h: stdlib.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -679,19 +862,21 @@ stdlib.h: stdlib_.h
-e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+ -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
-e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/stdlib_.h; \
+ < $(srcdir)/stdlib.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdlib.h stdlib.h-t
-EXTRA_DIST += stdlib_.h
+EXTRA_DIST += stdlib.in.h
## end gnulib module stdlib
@@ -746,7 +931,7 @@ BUILT_SOURCES += string.h
# We need the following in order to create <string.h> when the system
# doesn't have one that works with the given compiler.
-string.h: string_.h
+string.h: string.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -778,13 +963,12 @@ string.h: string_.h
-e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
-e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
-e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
+ -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
-e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
-e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
- -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
- -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
-e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
-e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
@@ -794,16 +978,41 @@ string.h: string_.h
-e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+ -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
+ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/string_.h; \
+ < $(srcdir)/string.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += string.h string.h-t
-EXTRA_DIST += string_.h
+EXTRA_DIST += string.in.h
## end gnulib module string
+## begin gnulib module strings
+
+BUILT_SOURCES += strings.h
+
+# We need the following in order to create <strings.h> when the system
+# doesn't have one that works with the given compiler.
+strings.h: strings.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+ -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
+ -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
+ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
+ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ < $(srcdir)/strings.in.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += strings.h strings.h-t
+
+EXTRA_DIST += strings.in.h
+
+## end gnulib module strings
+
## begin gnulib module strndup
@@ -846,20 +1055,20 @@ BUILT_SOURCES += $(SYS_SELECT_H)
# We need the following in order to create <sys/select.h> when the system
# doesn't have one that works with the given compiler.
-sys/select.h:
+sys/select.h: sys_select.in.h
@MKDIR_P@ sys
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
-e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
- < $(srcdir)/sys_select_.h; \
+ < $(srcdir)/sys_select.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += sys/select.h sys/select.h-t
MOSTLYCLEANDIRS += sys
-EXTRA_DIST += sys_select_.h
+EXTRA_DIST += sys_select.in.h
## end gnulib module sys_select
@@ -869,7 +1078,7 @@ BUILT_SOURCES += $(SYS_SOCKET_H)
# We need the following in order to create <sys/socket.h> when the system
# doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket_.h
+sys/socket.h: sys_socket.in.h
@MKDIR_P@ sys
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -877,13 +1086,13 @@ sys/socket.h: sys_socket_.h
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
- < $(srcdir)/sys_socket_.h; \
+ < $(srcdir)/sys_socket.in.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
MOSTLYCLEANDIRS += sys
-EXTRA_DIST += sys_socket_.h
+EXTRA_DIST += sys_socket.in.h
## end gnulib module sys_socket
@@ -893,7 +1102,7 @@ BUILT_SOURCES += $(SYS_STAT_H)
# We need the following in order to create <sys/stat.h> when the system
# has one that is incomplete.
-sys/stat.h: sys_stat_.h
+sys/stat.h: sys_stat.in.h
@MKDIR_P@ sys
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -902,13 +1111,13 @@ sys/stat.h: sys_stat_.h
-e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
- < $(srcdir)/sys_stat_.h; \
+ < $(srcdir)/sys_stat.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
MOSTLYCLEANDIRS += sys
-EXTRA_DIST += sys_stat_.h
+EXTRA_DIST += sys_stat.in.h
## end gnulib module sys_stat
@@ -918,7 +1127,7 @@ BUILT_SOURCES += $(SYS_TIME_H)
# We need the following in order to create <sys/time.h> when the system
# doesn't have one that works with the given compiler.
-sys/time.h: sys_time_.h
+sys/time.h: sys_time.in.h
@MKDIR_P@ sys
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -927,12 +1136,12 @@ sys/time.h: sys_time_.h
-e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
- < $(srcdir)/sys_time_.h; \
+ < $(srcdir)/sys_time.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += sys/time.h sys/time.h-t
-EXTRA_DIST += sys_time_.h
+EXTRA_DIST += sys_time.in.h
## end gnulib module sys_time
@@ -942,17 +1151,17 @@ BUILT_SOURCES += $(SYSEXITS_H)
# We need the following in order to create <sysexits.h> when the system
# doesn't have one that works with the given compiler.
-sysexits.h: sysexits_.h
+sysexits.h: sysexits.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \
-e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_SYSEXITS_H''@|$(NEXT_SYSEXITS_H)|g' \
- < $(srcdir)/sysexits_.h; \
+ < $(srcdir)/sysexits.in.h; \
} > $@-t
mv -f $@-t $@
MOSTLYCLEANFILES += sysexits.h sysexits.h-t
-EXTRA_DIST += sysexits_.h
+EXTRA_DIST += sysexits.in.h
## end gnulib module sysexits
@@ -971,7 +1180,7 @@ BUILT_SOURCES += unistd.h
# We need the following in order to create an empty placeholder for
# <unistd.h> when the system doesn't have one.
-unistd.h: unistd_.h
+unistd.h: unistd.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -983,29 +1192,42 @@ unistd.h: unistd_.h
-e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
-e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
-e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
-e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
-e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
-e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
-e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
-e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
-e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
+ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
- < $(srcdir)/unistd_.h; \
+ < $(srcdir)/unistd.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += unistd.h unistd.h-t
-EXTRA_DIST += unistd_.h
+EXTRA_DIST += unistd.in.h
## end gnulib module unistd
+## begin gnulib module unistd-safer
+
+
+EXTRA_DIST += dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h
+
+EXTRA_libgnu_a_SOURCES += dup-safer.c fd-safer.c pipe-safer.c
+
+## end gnulib module unistd-safer
+
## begin gnulib module vasnprintf
@@ -1039,7 +1261,7 @@ BUILT_SOURCES += $(WCHAR_H)
# We need the following in order to create <wchar.h> when the system
# version does not work standalone.
-wchar.h: wchar_.h
+wchar.h: wchar.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1049,12 +1271,12 @@ wchar.h: wchar_.h
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/wchar_.h; \
+ < $(srcdir)/wchar.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += wchar.h wchar.h-t
-EXTRA_DIST += wchar_.h
+EXTRA_DIST += wchar.in.h
## end gnulib module wchar
@@ -1064,7 +1286,7 @@ BUILT_SOURCES += $(WCTYPE_H)
# We need the following in order to create <wctype.h> when the system
# doesn't have one that works with the given compiler.
-wctype.h: wctype_.h
+wctype.h: wctype.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
@@ -1072,12 +1294,12 @@ wctype.h: wctype_.h
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
-e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
- < $(srcdir)/wctype_.h; \
+ < $(srcdir)/wctype.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += wctype.h wctype.h-t
-EXTRA_DIST += wctype_.h
+EXTRA_DIST += wctype.in.h
## end gnulib module wctype
diff --git a/gnulib/lib/Makefile.in b/gnulib/lib/Makefile.in
index 81f2ef2f..764b2d36 100644
--- a/gnulib/lib/Makefile.in
+++ b/gnulib/lib/Makefile.in
@@ -52,19 +52,25 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/gnulib/m4/argp.m4 \
$(top_srcdir)/gnulib/m4/atexit.m4 \
+ $(top_srcdir)/gnulib/m4/canonicalize-lgpl.m4 \
$(top_srcdir)/gnulib/m4/canonicalize.m4 \
- $(top_srcdir)/gnulib/m4/cycle-check.m4 \
+ $(top_srcdir)/gnulib/m4/chdir-long.m4 \
+ $(top_srcdir)/gnulib/m4/chown.m4 \
$(top_srcdir)/gnulib/m4/d-ino.m4 \
$(top_srcdir)/gnulib/m4/d-type.m4 \
$(top_srcdir)/gnulib/m4/dirfd.m4 \
$(top_srcdir)/gnulib/m4/dirname.m4 \
$(top_srcdir)/gnulib/m4/dos.m4 \
$(top_srcdir)/gnulib/m4/double-slash-root.m4 \
+ $(top_srcdir)/gnulib/m4/dup2.m4 \
$(top_srcdir)/gnulib/m4/eealloc.m4 \
$(top_srcdir)/gnulib/m4/eoverflow.m4 \
$(top_srcdir)/gnulib/m4/error.m4 \
$(top_srcdir)/gnulib/m4/exitfail.m4 \
$(top_srcdir)/gnulib/m4/extensions.m4 \
+ $(top_srcdir)/gnulib/m4/fchdir.m4 \
+ $(top_srcdir)/gnulib/m4/fcntl-safer.m4 \
+ $(top_srcdir)/gnulib/m4/fcntl_h.m4 \
$(top_srcdir)/gnulib/m4/filenamecat.m4 \
$(top_srcdir)/gnulib/m4/float_h.m4 \
$(top_srcdir)/gnulib/m4/fnmatch.m4 \
@@ -77,22 +83,30 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/gnulib/m4/glob.m4 \
$(top_srcdir)/gnulib/m4/gnulib-common.m4 \
$(top_srcdir)/gnulib/m4/gnulib-comp.m4 \
+ $(top_srcdir)/gnulib/m4/hash.m4 \
$(top_srcdir)/gnulib/m4/include_next.m4 \
$(top_srcdir)/gnulib/m4/inline.m4 \
$(top_srcdir)/gnulib/m4/intmax_t.m4 \
+ $(top_srcdir)/gnulib/m4/lchown.m4 \
$(top_srcdir)/gnulib/m4/localcharset.m4 \
+ $(top_srcdir)/gnulib/m4/lstat.m4 \
$(top_srcdir)/gnulib/m4/malloc.m4 \
$(top_srcdir)/gnulib/m4/malloca.m4 \
$(top_srcdir)/gnulib/m4/mbstate_t.m4 \
$(top_srcdir)/gnulib/m4/memcmp.m4 \
$(top_srcdir)/gnulib/m4/mempcpy.m4 \
+ $(top_srcdir)/gnulib/m4/memrchr.m4 \
$(top_srcdir)/gnulib/m4/minmax.m4 \
$(top_srcdir)/gnulib/m4/mkdtemp.m4 \
$(top_srcdir)/gnulib/m4/mkstemp.m4 \
$(top_srcdir)/gnulib/m4/onceonly_2_57.m4 \
+ $(top_srcdir)/gnulib/m4/openat.m4 \
+ $(top_srcdir)/gnulib/m4/pathmax.m4 \
$(top_srcdir)/gnulib/m4/readlink.m4 \
$(top_srcdir)/gnulib/m4/regex.m4 \
$(top_srcdir)/gnulib/m4/rename.m4 \
+ $(top_srcdir)/gnulib/m4/same.m4 \
+ $(top_srcdir)/gnulib/m4/save-cwd.m4 \
$(top_srcdir)/gnulib/m4/setenv.m4 \
$(top_srcdir)/gnulib/m4/sleep.m4 \
$(top_srcdir)/gnulib/m4/ssize_t.m4 \
@@ -107,6 +121,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/gnulib/m4/strdup.m4 \
$(top_srcdir)/gnulib/m4/strerror.m4 \
$(top_srcdir)/gnulib/m4/string_h.m4 \
+ $(top_srcdir)/gnulib/m4/strings_h.m4 \
$(top_srcdir)/gnulib/m4/strndup.m4 \
$(top_srcdir)/gnulib/m4/strnlen.m4 \
$(top_srcdir)/gnulib/m4/strpbrk.m4 \
@@ -117,6 +132,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/gnulib/m4/sys_time_h.m4 \
$(top_srcdir)/gnulib/m4/sysexits.m4 \
$(top_srcdir)/gnulib/m4/tempname.m4 \
+ $(top_srcdir)/gnulib/m4/unistd-safer.m4 \
$(top_srcdir)/gnulib/m4/unistd_h.m4 \
$(top_srcdir)/gnulib/m4/vasnprintf.m4 \
$(top_srcdir)/gnulib/m4/vasprintf.m4 \
@@ -130,13 +146,12 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
- $(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intmax.m4 \
- $(top_srcdir)/m4/inttypes-pri.m4 \
+ $(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+ $(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/lock.m4 \
- $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/man-bdb.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/man-bdb.m4 \
$(top_srcdir)/m4/man-check-progs.m4 \
$(top_srcdir)/m4/man-gnu-nroff.m4 \
$(top_srcdir)/m4/man-strsignal.m4 \
@@ -161,9 +176,11 @@ am_libgnu_a_OBJECTS = areadlink-with-size.$(OBJEXT) argp-ba.$(OBJEXT) \
argp-eexst.$(OBJEXT) argp-fmtstream.$(OBJEXT) \
argp-fs-xinl.$(OBJEXT) argp-help.$(OBJEXT) \
argp-parse.$(OBJEXT) argp-pin.$(OBJEXT) argp-pv.$(OBJEXT) \
- argp-pvh.$(OBJEXT) argp-xinl.$(OBJEXT) localcharset.$(OBJEXT) \
- lock.$(OBJEXT) malloca.$(OBJEXT) xalloc-die.$(OBJEXT) \
- xstrndup.$(OBJEXT) xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT)
+ argp-pvh.$(OBJEXT) argp-xinl.$(OBJEXT) file-set.$(OBJEXT) \
+ hash-pjw.$(OBJEXT) hash-triple.$(OBJEXT) \
+ localcharset.$(OBJEXT) lock.$(OBJEXT) malloca.$(OBJEXT) \
+ openat-die.$(OBJEXT) xalloc-die.$(OBJEXT) xstrndup.$(OBJEXT) \
+ xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT)
libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
@@ -205,16 +222,19 @@ DATADIRNAME = @DATADIRNAME@
DBLIBS = @DBLIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DIRENT_H = @DIRENT_H@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EOVERFLOW = @EOVERFLOW@
EXEEXT = @EXEEXT@
+FCNTL_H = @FCNTL_H@
FLOAT_H = @FLOAT_H@
FNMATCH_H = @FNMATCH_H@
GENCAT = @GENCAT@
GETOPT_H = @GETOPT_H@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GLIBC2 = @GLIBC2@
GLIBC21 = @GLIBC21@
GLOB_H = @GLOB_H@
@@ -225,7 +245,9 @@ GNULIB_CHOWN = @GNULIB_CHOWN@
GNULIB_DUP2 = @GNULIB_DUP2@
GNULIB_FCHDIR = @GNULIB_FCHDIR@
GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
GNULIB_FSEEK = @GNULIB_FSEEK@
GNULIB_FSEEKO = @GNULIB_FSEEKO@
GNULIB_FTELL = @GNULIB_FTELL@
@@ -235,6 +257,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
GNULIB_GETDELIM = @GNULIB_GETDELIM@
GNULIB_GETLINE = @GNULIB_GETLINE@
GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
GNULIB_LCHOWN = @GNULIB_LCHOWN@
GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -258,7 +281,9 @@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_OPEN = @GNULIB_OPEN@
GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
GNULIB_READLINK = @GNULIB_READLINK@
GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
GNULIB_SLEEP = @GNULIB_SLEEP@
@@ -269,6 +294,7 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
GNULIB_STRNDUP = @GNULIB_STRNDUP@
GNULIB_STRNLEN = @GNULIB_STRNLEN@
GNULIB_STRPBRK = @GNULIB_STRPBRK@
@@ -291,6 +317,7 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
@@ -301,6 +328,7 @@ HAVE_DUP2 = @HAVE_DUP2@
HAVE_FSEEKO = @HAVE_FSEEKO@
HAVE_FTELLO = @HAVE_FTELLO@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_IO_H = @HAVE_IO_H@
@@ -310,6 +338,7 @@ HAVE_LSTAT = @HAVE_LSTAT@
HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
HAVE_MEMPCPY = @HAVE_MEMPCPY@
HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_OS_H = @HAVE_OS_H@
HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@
HAVE_READLINK = @HAVE_READLINK@
HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
@@ -332,6 +361,7 @@ HAVE_SYSEXITS_H = @HAVE_SYSEXITS_H@
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@
HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
@@ -370,10 +400,12 @@ LIBINTL = @LIBINTL@
LIBMULTITHREAD = @LIBMULTITHREAD@
LIBOBJS = @LIBOBJS@
LIBPTH = @LIBPTH@
+LIBPTH_PREFIX = @LIBPTH_PREFIX@
LIBS = @LIBS@
LIBTHREAD = @LIBTHREAD@
LINGUAS = @LINGUAS@
LN_S = @LN_S@
+LTLIBC = @LTLIBC@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -385,10 +417,13 @@ MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
+NEXT_DIRENT_H = @NEXT_DIRENT_H@
+NEXT_FCNTL_H = @NEXT_FCNTL_H@
NEXT_FLOAT_H = @NEXT_FLOAT_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_STRINGS_H = @NEXT_STRINGS_H@
NEXT_STRING_H = @NEXT_STRING_H@
NEXT_SYSEXITS_H = @NEXT_SYSEXITS_H@
NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@
@@ -413,7 +448,9 @@ RANLIB = @RANLIB@
REPLACE_CHOWN = @REPLACE_CHOWN@
REPLACE_FCHDIR = @REPLACE_FCHDIR@
REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
REPLACE_FSEEK = @REPLACE_FSEEK@
REPLACE_FSEEKO = @REPLACE_FSEEKO@
REPLACE_FTELL = @REPLACE_FTELL@
@@ -424,9 +461,12 @@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
REPLACE_LSEEK = @REPLACE_LSEEK@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_OPEN = @REPLACE_OPEN@
REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRERROR = @REPLACE_STRERROR@
REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -469,10 +509,13 @@ VERSION = @VERSION@
WCHAR_H = @WCHAR_H@
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
WCTYPE_H = @WCTYPE_H@
+WINDRES = @WINDRES@
WINT_T_SUFFIX = @WINT_T_SUFFIX@
+WOE32 = @WOE32@
WOE32DLL = @WOE32DLL@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -559,42 +602,52 @@ AUTOMAKE_OPTIONS = 1.5 gnits
noinst_HEADERS =
noinst_LIBRARIES = libgnu.a
noinst_LTLIBRARIES =
-EXTRA_DIST = alloca.c alloca_.h areadlink.h argp-namefrob.h \
+EXTRA_DIST = alloca.c alloca.in.h areadlink.h argp-namefrob.h \
argp-parse.c argp-pin.c argp-pv.c argp-pvh.c argp-xinl.c \
- atexit.c canonicalize.c canonicalize.h pathmax.h cycle-check.c \
- cycle-check.h dev-ino.h dirfd.c dirfd.h basename.c dirname.c \
- dirname.h stripslash.c error.c error.h exitfail.c exitfail.h \
- filenamecat.c filenamecat.h float_.h fnmatch.c fnmatch_.h \
- fnmatch_loop.c getcwd.c getlogin_r.c getopt.c getopt1.c \
- getopt_.h getopt_int.h gettimeofday.c glob-libc.h glob.c \
- glob_.h $(top_srcdir)/tools/config.rpath \
- $(top_srcdir)/tools/link-warning.h config.charset ref-add.sin \
- ref-del.sin $(top_srcdir)/tools/config.rpath malloc.c malloc.c \
- malloca.h malloca.valgrind memcmp.c mempcpy.c mkdtemp.c \
- mkstemp.c readlink.c regcomp.c regex.c regex.h \
- regex_internal.c regex_internal.h regexec.c rename.c \
- same-inode.h setenv.c setenv.h unsetenv.c sleep.c stdbool_.h \
- stdint_.h stdio_.h stdlib_.h strcasecmp.c strncasecmp.c \
- strchrnul.c strcspn.c strdup.c strerror.c string_.h strndup.c \
- strnlen.c strpbrk.c strsep.c sys_select_.h sys_socket_.h \
- sys_stat_.h sys_time_.h sysexits_.h tempname.c tempname.h \
- unistd_.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 vsnprintf.c wchar_.h wctype_.h xalloc.h \
- xmalloc.c xgetcwd.c xgetcwd.h xalloc.h
-BUILT_SOURCES = $(ALLOCA_H) configmake.h $(FLOAT_H) $(FNMATCH_H) \
- $(GETOPT_H) $(GLOB_H) $(STDBOOL_H) $(STDINT_H) stdio.h \
- stdlib.h string.h $(SYS_SELECT_H) $(SYS_SOCKET_H) \
- $(SYS_STAT_H) $(SYS_TIME_H) $(SYSEXITS_H) unistd.h $(WCHAR_H) \
- $(WCTYPE_H)
+ atexit.c canonicalize.c canonicalize.h pathmax.h \
+ canonicalize-lgpl.c canonicalize.h chdir-long.c chdir-long.h \
+ chown.c fchown-stub.c dirfd.c dirfd.h basename.c dirname.c \
+ dirname.h stripslash.c dup2.c error.c error.h exitfail.c \
+ exitfail.h dirent.in.h fchdir.c fcntl.in.h creat-safer.c \
+ fcntl--.h fcntl-safer.h open-safer.c file-set.h filenamecat.c \
+ filenamecat.h float.in.h fnmatch.c fnmatch.in.h fnmatch_loop.c \
+ getcwd.c getlogin_r.c getopt.c getopt.in.h getopt1.c \
+ getopt_int.h gettimeofday.c glob-libc.h glob.c glob.in.h \
+ hash.c hash.h hash-triple.h $(top_srcdir)/tools/config.rpath \
+ intprops.h lchown.c $(top_srcdir)/tools/link-warning.h \
+ config.charset ref-add.sin ref-del.sin \
+ $(top_srcdir)/tools/config.rpath lstat.c lstat.h malloc.c \
+ malloc.c malloca.h malloca.valgrind memcmp.c mempcpy.c \
+ memrchr.c mkdtemp.c mkstemp.c at-func.c fchmodat.c fchownat.c \
+ fstatat.c mkdirat.c openat-priv.h openat-proc.c openat.c \
+ openat.h pathmax.h readlink.c regcomp.c regex.c regex.h \
+ regex_internal.c regex_internal.h regexec.c rename.c same.c \
+ same.h same-inode.h save-cwd.c save-cwd.h setenv.c setenv.h \
+ unsetenv.c sleep.c stdbool.in.h stdint.in.h stdio.in.h \
+ stdlib.in.h strcasecmp.c strncasecmp.c strchrnul.c strcspn.c \
+ strdup.c strerror.c string.in.h strings.in.h strndup.c \
+ strnlen.c strpbrk.c strsep.c sys_select.in.h sys_socket.in.h \
+ sys_stat.in.h sys_time.in.h sysexits.in.h tempname.c \
+ tempname.h unistd.in.h dup-safer.c fd-safer.c pipe-safer.c \
+ unistd--.h unistd-safer.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 vsnprintf.c wchar.in.h \
+ wctype.in.h xalloc.h xmalloc.c xgetcwd.c xgetcwd.h xalloc.h
+BUILT_SOURCES = $(ALLOCA_H) configmake.h $(DIRENT_H) $(FCNTL_H) \
+ $(FLOAT_H) $(FNMATCH_H) $(GETOPT_H) $(GLOB_H) $(STDBOOL_H) \
+ $(STDINT_H) stdio.h stdlib.h string.h strings.h \
+ $(SYS_SELECT_H) $(SYS_SOCKET_H) $(SYS_STAT_H) $(SYS_TIME_H) \
+ $(SYSEXITS_H) unistd.h $(WCHAR_H) $(WCTYPE_H)
SUFFIXES = .sed .sin
-MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t float.h \
- float.h-t fnmatch.h fnmatch.h-t getopt.h getopt.h-t glob.h \
- glob.h-t stdbool.h stdbool.h-t stdint.h stdint.h-t stdio.h \
- stdio.h-t stdlib.h stdlib.h-t string.h string.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 sysexits.h sysexits.h-t \
- unistd.h unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t
+MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t dirent.h \
+ dirent.h-t fcntl.h fcntl.h-t float.h float.h-t fnmatch.h \
+ fnmatch.h-t getopt.h getopt.h-t glob.h glob.h-t stdbool.h \
+ stdbool.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/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 sysexits.h \
+ sysexits.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h \
+ wctype.h-t
MOSTLYCLEANDIRS = sys sys sys
CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \
ref-del.sed
@@ -604,23 +657,29 @@ AM_CPPFLAGS = -DDEFAULT_TEXT_DOMAIN=\"man-db-gnulib\"
libgnu_a_SOURCES = areadlink-with-size.c argp.h argp-ba.c argp-eexst.c \
argp-fmtstream.c argp-fmtstream.h argp-fs-xinl.c argp-help.c \
argp-namefrob.h argp-parse.c argp-pin.c argp-pv.c argp-pvh.c \
- argp-xinl.c gettext.h localcharset.h localcharset.c lock.h \
- lock.c malloca.c minmax.h size_max.h xalloc-die.c xsize.h \
- xstrndup.h xstrndup.c xvasprintf.h xvasprintf.c xasprintf.c
+ argp-xinl.c file-set.c gettext.h hash-pjw.h hash-pjw.c \
+ hash-triple.c localcharset.h localcharset.c lock.h lock.c \
+ malloca.c minmax.h openat-die.c size_max.h xalloc-die.c \
+ xsize.h xstrndup.h xstrndup.c xvasprintf.h xvasprintf.c \
+ xasprintf.c
libgnu_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
EXTRA_libgnu_a_SOURCES = alloca.c argp-parse.c argp-pin.c argp-pv.c \
- argp-pvh.c argp-xinl.c atexit.c canonicalize.c cycle-check.c \
- dirfd.c basename.c dirname.c stripslash.c error.c exitfail.c \
- filenamecat.c fnmatch.c fnmatch_loop.c getcwd.c getlogin_r.c \
- getopt.c getopt1.c gettimeofday.c glob.c malloc.c malloc.c \
- memcmp.c mempcpy.c mkdtemp.c mkstemp.c readlink.c regcomp.c \
- regex.c regex_internal.c regexec.c rename.c setenv.c \
+ argp-pvh.c argp-xinl.c atexit.c canonicalize.c \
+ canonicalize-lgpl.c chdir-long.c chown.c fchown-stub.c dirfd.c \
+ basename.c dirname.c stripslash.c dup2.c error.c exitfail.c \
+ fchdir.c creat-safer.c open-safer.c filenamecat.c fnmatch.c \
+ fnmatch_loop.c getcwd.c getlogin_r.c getopt.c getopt1.c \
+ gettimeofday.c glob.c hash.c lchown.c lstat.c malloc.c \
+ malloc.c memcmp.c mempcpy.c memrchr.c mkdtemp.c mkstemp.c \
+ at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c \
+ openat-proc.c openat.c readlink.c regcomp.c regex.c \
+ regex_internal.c regexec.c rename.c same.c save-cwd.c setenv.c \
unsetenv.c sleep.c strcasecmp.c strncasecmp.c strchrnul.c \
strcspn.c strdup.c strerror.c strndup.c strnlen.c strpbrk.c \
- strsep.c tempname.c asnprintf.c printf-args.c printf-parse.c \
- vasnprintf.c asprintf.c vasprintf.c vsnprintf.c xmalloc.c \
- xgetcwd.c
+ strsep.c tempname.c dup-safer.c fd-safer.c pipe-safer.c \
+ asnprintf.c printf-args.c printf-parse.c vasnprintf.c \
+ asprintf.c vasprintf.c vsnprintf.c xmalloc.c xgetcwd.c
# Use this preprocessor expression to decide whether #include_next works.
# Do not rely on a 'configure'-time test for this, since the expression
@@ -701,31 +760,56 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argp-xinl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atexit.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize-lgpl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cycle-check.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chdir-long.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chown.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/creat-safer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirfd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchdir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchmodat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchown-stub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchownat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file-set.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filenamecat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnmatch.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnmatch_loop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstatat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getlogin_r.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash-pjw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash-triple.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lchown.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.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)/memcmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mempcpy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memrchr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdirat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdtemp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open-safer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-die.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-proc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe-safer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-args.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@
@@ -734,6 +818,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex_internal.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexec.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/same.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/save-cwd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sleep.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp.Po@am__quote@
@@ -960,9 +1046,9 @@ uninstall-am: uninstall-local
# We need the following in order to create <alloca.h> when the system
# doesn't have one that works with the given compiler.
-alloca.h: alloca_.h
+alloca.h: alloca.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/alloca_.h; \
+ cat $(srcdir)/alloca.in.h; \
} > $@-t
mv -f $@-t $@
@@ -1016,39 +1102,64 @@ configmake.h: Makefile
} | sed '/""/d' > $@-t
mv $@-t $@
+# We need the following in order to create <dirent.h> when the system
+# doesn't have one that works with the given compiler.
+dirent.h: dirent.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
+ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+ < $(srcdir)/dirent.in.h; \
+ } > $@-t
+ mv $@-t $@
+
+# We need the following in order to create <fcntl.h> when the system
+# doesn't have one that works with the given compiler.
+fcntl.h: fcntl.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+ -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
+ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
+ < $(srcdir)/fcntl.in.h; \
+ } > $@-t
+ mv $@-t $@
+
# We need the following in order to create <float.h> when the system
# doesn't have one that works with the given compiler.
-float.h: float_.h
+float.h: float.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
- < $(srcdir)/float_.h; \
+ < $(srcdir)/float.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <fnmatch.h> when the system
# doesn't have one that supports the required API.
-fnmatch.h: fnmatch_.h
+fnmatch.h: fnmatch.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/fnmatch_.h; \
+ cat $(srcdir)/fnmatch.in.h; \
} > $@-t
mv -f $@-t $@
# 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_.h
+getopt.h: getopt.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/getopt_.h; \
+ cat $(srcdir)/getopt.in.h; \
} > $@-t
mv -f $@-t $@
# We need the following in order to create <glob.h> when the system
# doesn't have one that works with the given compiler.
-glob.h: glob_.h
+glob.h: glob.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
- < $(srcdir)/glob_.h; \
+ < $(srcdir)/glob.in.h; \
} > $@-t
mv -f $@-t $@
@@ -1097,16 +1208,16 @@ charset.alias: config.charset
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
-stdbool.h: stdbool_.h
+stdbool.h: stdbool.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
+ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <stdint.h> when the system
# doesn't have one that works with the given compiler.
-stdint.h: stdint_.h
+stdint.h: stdint.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
@@ -1131,13 +1242,13 @@ stdint.h: stdint_.h
-e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
-e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
-e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
- < $(srcdir)/stdint_.h; \
+ < $(srcdir)/stdint.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <stdio.h> when the system
# doesn't have one that works with the given compiler.
-stdio.h: stdio_.h
+stdio.h: stdio.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1151,6 +1262,8 @@ stdio.h: stdio_.h
-e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
-e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+ -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
+ -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
-e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
-e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
-e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
@@ -1170,6 +1283,8 @@ stdio.h: stdio_.h
-e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
+ -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
-e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
-e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
@@ -1179,13 +1294,13 @@ stdio.h: stdio_.h
-e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
-e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/stdio_.h; \
+ < $(srcdir)/stdio.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
-stdlib.h: stdlib_.h
+stdlib.h: stdlib.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1196,20 +1311,22 @@ stdlib.h: stdlib_.h
-e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+ -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
-e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/stdlib_.h; \
+ < $(srcdir)/stdlib.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <string.h> when the system
# doesn't have one that works with the given compiler.
-string.h: string_.h
+string.h: string.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1241,13 +1358,12 @@ string.h: string_.h
-e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
-e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
-e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
+ -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
-e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
-e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
- -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
- -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
-e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
-e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
@@ -1257,27 +1373,43 @@ string.h: string_.h
-e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+ -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
+ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
+ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ < $(srcdir)/string.in.h; \
+ } > $@-t
+ mv $@-t $@
+
+# We need the following in order to create <strings.h> when the system
+# doesn't have one that works with the given compiler.
+strings.h: strings.in.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+ -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
+ -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
+ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/string_.h; \
+ < $(srcdir)/strings.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <sys/select.h> when the system
# doesn't have one that works with the given compiler.
-sys/select.h:
+sys/select.h: sys_select.in.h
@MKDIR_P@ sys
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
-e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
- < $(srcdir)/sys_select_.h; \
+ < $(srcdir)/sys_select.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <sys/socket.h> when the system
# doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket_.h
+sys/socket.h: sys_socket.in.h
@MKDIR_P@ sys
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1285,13 +1417,13 @@ sys/socket.h: sys_socket_.h
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
- < $(srcdir)/sys_socket_.h; \
+ < $(srcdir)/sys_socket.in.h; \
} > $@-t
mv -f $@-t $@
# We need the following in order to create <sys/stat.h> when the system
# has one that is incomplete.
-sys/stat.h: sys_stat_.h
+sys/stat.h: sys_stat.in.h
@MKDIR_P@ sys
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1300,13 +1432,13 @@ sys/stat.h: sys_stat_.h
-e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
- < $(srcdir)/sys_stat_.h; \
+ < $(srcdir)/sys_stat.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <sys/time.h> when the system
# doesn't have one that works with the given compiler.
-sys/time.h: sys_time_.h
+sys/time.h: sys_time.in.h
@MKDIR_P@ sys
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1315,24 +1447,24 @@ sys/time.h: sys_time_.h
-e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
- < $(srcdir)/sys_time_.h; \
+ < $(srcdir)/sys_time.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <sysexits.h> when the system
# doesn't have one that works with the given compiler.
-sysexits.h: sysexits_.h
+sysexits.h: sysexits.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \
-e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_SYSEXITS_H''@|$(NEXT_SYSEXITS_H)|g' \
- < $(srcdir)/sysexits_.h; \
+ < $(srcdir)/sysexits.in.h; \
} > $@-t
mv -f $@-t $@
# We need the following in order to create an empty placeholder for
# <unistd.h> when the system doesn't have one.
-unistd.h: unistd_.h
+unistd.h: unistd.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -1344,27 +1476,31 @@ unistd.h: unistd_.h
-e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
-e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
-e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
-e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
-e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
-e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
-e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
-e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
-e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
+ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
- < $(srcdir)/unistd_.h; \
+ < $(srcdir)/unistd.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <wchar.h> when the system
# version does not work standalone.
-wchar.h: wchar_.h
+wchar.h: wchar.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1374,13 +1510,13 @@ wchar.h: wchar_.h
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
- < $(srcdir)/wchar_.h; \
+ < $(srcdir)/wchar.in.h; \
} > $@-t
mv $@-t $@
# We need the following in order to create <wctype.h> when the system
# doesn't have one that works with the given compiler.
-wctype.h: wctype_.h
+wctype.h: wctype.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
@@ -1388,7 +1524,7 @@ wctype.h: wctype_.h
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
-e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
- < $(srcdir)/wctype_.h; \
+ < $(srcdir)/wctype.in.h; \
} > $@-t
mv $@-t $@
diff --git a/gnulib/lib/alloca.c b/gnulib/lib/alloca.c
index 3a1f4e27..ff1cb7e9 100644
--- a/gnulib/lib/alloca.c
+++ b/gnulib/lib/alloca.c
@@ -486,4 +486,4 @@ i00afunc (long address)
# endif /* CRAY */
# endif /* no alloca */
-#endif /* not GCC version 2 */
+#endif /* not GCC version 3 */
diff --git a/gnulib/lib/alloca_.h b/gnulib/lib/alloca.in.h
index af274b9e..82782884 100644
--- a/gnulib/lib/alloca_.h
+++ b/gnulib/lib/alloca.in.h
@@ -5,7 +5,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/areadlink-with-size.c b/gnulib/lib/areadlink-with-size.c
index fdaab3f4..d0bcb70a 100644
--- a/gnulib/lib/areadlink-with-size.c
+++ b/gnulib/lib/areadlink-with-size.c
@@ -3,10 +3,10 @@
Copyright (C) 2001, 2003-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -14,9 +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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering <jim@meyering.net> */
diff --git a/gnulib/lib/areadlink.h b/gnulib/lib/areadlink.h
index 7187f71d..8720ed9a 100644
--- a/gnulib/lib/areadlink.h
+++ b/gnulib/lib/areadlink.h
@@ -2,10 +2,10 @@
Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,9 +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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering <jim@meyering.net> */
diff --git a/gnulib/lib/argp-ba.c b/gnulib/lib/argp-ba.c
index 8bb7309f..3e8bb962 100644
--- a/gnulib/lib/argp-ba.c
+++ b/gnulib/lib/argp-ba.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* If set by the user program, it should point to string that is the
bug-reporting address for the program. It will be printed by argp_help if
diff --git a/gnulib/lib/argp-eexst.c b/gnulib/lib/argp-eexst.c
index bcab1c0c..0a81c279 100644
--- a/gnulib/lib/argp-eexst.c
+++ b/gnulib/lib/argp-eexst.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/gnulib/lib/argp-fmtstream.c b/gnulib/lib/argp-fmtstream.c
index 0dd9256f..c89a99ca 100644
--- a/gnulib/lib/argp-fmtstream.c
+++ b/gnulib/lib/argp-fmtstream.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This package emulates glibc `line_wrap_stream' semantics for systems that
don't have that. */
diff --git a/gnulib/lib/argp-fmtstream.h b/gnulib/lib/argp-fmtstream.h
index e045a723..50f1387f 100644
--- a/gnulib/lib/argp-fmtstream.h
+++ b/gnulib/lib/argp-fmtstream.h
@@ -1,21 +1,20 @@
/* Word-wrapping and line-truncating streams.
- Copyright (C) 1997, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006-2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This package emulates glibc `line_wrap_stream' semantics for systems that
don't have that. If the system does have it, it is just a wrapper for
@@ -135,6 +134,7 @@ extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
const char *__fmt, ...)
__attribute__ ((__format__ (printf, 2, 3)));
+#if _LIBC || !defined __OPTIMIZE__
extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
@@ -145,6 +145,7 @@ extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
+#endif
/* Access macros for various bits of state. */
#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
@@ -154,6 +155,7 @@ extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
+#if _LIBC || !defined __OPTIMIZE__
/* Set __FS's left margin to LMARGIN and return the old value. */
extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
size_t __lmargin);
@@ -175,6 +177,7 @@ extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
/* Return the column number of the current output point in __FS. */
extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
+#endif
/* Internal routines. */
extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
@@ -198,7 +201,28 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
#endif
#ifndef ARGP_FS_EI
-#define ARGP_FS_EI extern inline
+# ifdef __GNUC__
+ /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+ inline semantics, unless -fgnu89-inline is used. It defines a macro
+ __GNUC_STDC_INLINE__ to indicate this situation or a macro
+ __GNUC_GNU_INLINE__ to indicate the opposite situation.
+ GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
+ semantics but warns, unless -fgnu89-inline is used:
+ warning: C99 inline functions are not supported; using GNU89
+ warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
+ It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */
+# if defined __GNUC_STDC_INLINE__
+# define ARGP_FS_EI inline
+# elif defined __GNUC_GNU_INLINE__
+# define ARGP_FS_EI extern inline __attribute__ ((__gnu_inline__))
+# else
+# define ARGP_FS_EI extern inline
+# endif
+# else
+ /* With other compilers, assume the ISO C99 meaning of 'inline', if
+ the compiler supports 'inline' at all. */
+# define ARGP_FS_EI inline
+# endif
#endif
ARGP_FS_EI size_t
diff --git a/gnulib/lib/argp-fs-xinl.c b/gnulib/lib/argp-fs-xinl.c
index 3b4c917e..af4f0850 100644
--- a/gnulib/lib/argp-fs-xinl.c
+++ b/gnulib/lib/argp-fs-xinl.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/gnulib/lib/argp-help.c b/gnulib/lib/argp-help.c
index 1a4131fd..4c0ca60c 100644
--- a/gnulib/lib/argp-help.c
+++ b/gnulib/lib/argp-help.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
diff --git a/gnulib/lib/argp-namefrob.h b/gnulib/lib/argp-namefrob.h
index 6fe99cd7..fcb082ad 100644
--- a/gnulib/lib/argp-namefrob.h
+++ b/gnulib/lib/argp-namefrob.h
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
/* This code is written for inclusion in gnu-libc, and uses names in the
diff --git a/gnulib/lib/argp-parse.c b/gnulib/lib/argp-parse.c
index a7de7290..d86256a8 100644
--- a/gnulib/lib/argp-parse.c
+++ b/gnulib/lib/argp-parse.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/gnulib/lib/argp-pin.c b/gnulib/lib/argp-pin.c
index 852c6d6d..6707b0dc 100644
--- a/gnulib/lib/argp-pin.c
+++ b/gnulib/lib/argp-pin.c
@@ -1,19 +1,18 @@
/* Full and short program names for argp module
Copyright (C) 2005 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/gnulib/lib/argp-pv.c b/gnulib/lib/argp-pv.c
index a11298bf..411f6ede 100644
--- a/gnulib/lib/argp-pv.c
+++ b/gnulib/lib/argp-pv.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* If set by the user program to a non-zero value, then a default option
--version is added (unless the ARGP_NO_HELP flag is used), which will
diff --git a/gnulib/lib/argp-pvh.c b/gnulib/lib/argp-pvh.c
index 6bf7c49b..2ba037b9 100644
--- a/gnulib/lib/argp-pvh.c
+++ b/gnulib/lib/argp-pvh.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/gnulib/lib/argp-xinl.c b/gnulib/lib/argp-xinl.c
index a6afb1f7..0904e9dc 100644
--- a/gnulib/lib/argp-xinl.c
+++ b/gnulib/lib/argp-xinl.c
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/gnulib/lib/argp.h b/gnulib/lib/argp.h
index 1c4e06f8..aa76eb4e 100644
--- a/gnulib/lib/argp.h
+++ b/gnulib/lib/argp.h
@@ -3,19 +3,18 @@
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _ARGP_H
#define _ARGP_H
@@ -521,9 +520,11 @@ extern void __argp_state_help (const struct argp_state *__restrict __state,
FILE *__restrict __stream,
unsigned int __flags);
+#if _LIBC || !defined __USE_EXTERN_INLINES
/* Possibly output the standard usage message for ARGP to stderr and exit. */
extern void argp_usage (const struct argp_state *__state);
extern void __argp_usage (const struct argp_state *__state);
+#endif
/* If appropriate, print the printf string FMT and following args, preceded
by the program name and `:', to stderr, and followed by a `Try ... --help'
@@ -552,6 +553,7 @@ extern void __argp_failure (const struct argp_state *__restrict __state,
const char *__restrict __fmt, ...)
__attribute__ ((__format__ (__printf__, 4, 5)));
+#if _LIBC || !defined __USE_EXTERN_INLINES
/* Returns true if the option OPT is a valid short option. */
extern int _option_is_short (const struct argp_option *__opt) __THROW;
extern int __option_is_short (const struct argp_option *__opt) __THROW;
@@ -560,6 +562,7 @@ extern int __option_is_short (const struct argp_option *__opt) __THROW;
options array. */
extern int _option_is_end (const struct argp_option *__opt) __THROW;
extern int __option_is_end (const struct argp_option *__opt) __THROW;
+#endif
/* Return the input field for ARGP in the parser corresponding to STATE; used
by the help routines. */
@@ -580,7 +583,28 @@ extern void *__argp_input (const struct argp *__restrict __argp,
# endif
# ifndef ARGP_EI
-# define ARGP_EI extern __inline__
+# ifdef __GNUC__
+ /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+ inline semantics, unless -fgnu89-inline is used. It defines a macro
+ __GNUC_STDC_INLINE__ to indicate this situation or a macro
+ __GNUC_GNU_INLINE__ to indicate the opposite situation.
+ GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
+ semantics but warns, unless -fgnu89-inline is used:
+ warning: C99 inline functions are not supported; using GNU89
+ warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
+ It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */
+# if defined __GNUC_STDC_INLINE__
+# define ARGP_EI __inline__
+# elif defined __GNUC_GNU_INLINE__
+# define ARGP_EI extern __inline__ __attribute__ ((__gnu_inline__))
+# else
+# define ARGP_EI extern __inline__
+# endif
+# else
+ /* With other compilers, assume the ISO C99 meaning of 'inline', if
+ the compiler supports 'inline' at all. */
+# define ARGP_EI inline
+# endif
# endif
ARGP_EI void
diff --git a/gnulib/lib/asnprintf.c b/gnulib/lib/asnprintf.c
index 26c3988b..bf2abf3c 100644
--- a/gnulib/lib/asnprintf.c
+++ b/gnulib/lib/asnprintf.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/asprintf.c b/gnulib/lib/asprintf.c
index 1d51eac4..0bbecf81 100644
--- a/gnulib/lib/asprintf.c
+++ b/gnulib/lib/asprintf.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/at-func.c b/gnulib/lib/at-func.c
new file mode 100644
index 00000000..c7963fe3
--- /dev/null
+++ b/gnulib/lib/at-func.c
@@ -0,0 +1,85 @@
+/* Define an at-style functions like fstatat, unlinkat, fchownat, etc.
+ Copyright (C) 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#define CALL_FUNC(F) \
+ (AT_FUNC_USE_F1_COND \
+ ? AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS) \
+ : AT_FUNC_F2 (F AT_FUNC_POST_FILE_ARGS))
+
+/* Call AT_FUNC_F1 or AT_FUNC_F2 (testing AT_FUNC_USE_F1_COND to
+ determine which) to operate on FILE, which is in the directory
+ open on descriptor FD. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ then AT_FUNC_F?/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero. */
+int
+AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS)
+{
+ struct saved_cwd saved_cwd;
+ int saved_errno;
+ int err;
+
+ if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
+ return CALL_FUNC (file);
+
+ {
+ char buf[OPENAT_BUFFER_SIZE];
+ char *proc_file = openat_proc_name (buf, fd, file);
+ if (proc_file)
+ {
+ int proc_result = CALL_FUNC (proc_file);
+ int proc_errno = errno;
+ if (proc_file != buf)
+ free (proc_file);
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (0 <= proc_result)
+ return proc_result;
+ if (! EXPECTED_ERRNO (proc_errno))
+ {
+ errno = proc_errno;
+ return proc_result;
+ }
+ }
+ }
+
+ if (save_cwd (&saved_cwd) != 0)
+ openat_save_fail (errno);
+
+ if (fchdir (fd) != 0)
+ {
+ saved_errno = errno;
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return -1;
+ }
+
+ err = CALL_FUNC (file);
+ saved_errno = (err < 0 ? errno : 0);
+
+ if (restore_cwd (&saved_cwd) != 0)
+ openat_restore_fail (errno);
+
+ free_cwd (&saved_cwd);
+
+ if (saved_errno)
+ errno = saved_errno;
+ return err;
+}
+#undef CALL_FUNC
diff --git a/gnulib/lib/basename.c b/gnulib/lib/basename.c
index fbe17ff9..426ed40f 100644
--- a/gnulib/lib/basename.c
+++ b/gnulib/lib/basename.c
@@ -3,10 +3,10 @@
Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free
Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -14,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/canonicalize-lgpl.c b/gnulib/lib/canonicalize-lgpl.c
new file mode 100644
index 00000000..e8d2b65e
--- /dev/null
+++ b/gnulib/lib/canonicalize-lgpl.c
@@ -0,0 +1,362 @@
+/* Return the canonical absolute name of a given file.
+ Copyright (C) 1996-2003, 2005-2007 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,
+ 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/>. */
+
+#include <config.h>
+
+/* Avoid a clash of our rpl_realpath() function with the prototype in
+ <stdlib.h> on Solaris 2.5.1. */
+#undef realpath
+
+#if !HAVE_CANONICALIZE_FILE_NAME || defined _LIBC
+
+#include <alloca.h>
+
+/* Specification. */
+#include "canonicalize.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#include <limits.h>
+
+#if HAVE_SYS_PARAM_H || defined _LIBC
+# include <sys/param.h>
+#endif
+#ifndef MAXSYMLINKS
+# define MAXSYMLINKS 20
+#endif
+
+#include <sys/stat.h>
+
+#include <errno.h>
+#ifndef _LIBC
+# define __set_errno(e) errno = (e)
+# ifndef ENAMETOOLONG
+# define ENAMETOOLONG EINVAL
+# endif
+#endif
+
+#ifdef _LIBC
+# include <shlib-compat.h>
+#else
+# define SHLIB_COMPAT(lib, introduced, obsoleted) 0
+# define versioned_symbol(lib, local, symbol, version)
+# define compat_symbol(lib, local, symbol, version)
+# define weak_alias(local, symbol)
+# define __canonicalize_file_name canonicalize_file_name
+# define __realpath rpl_realpath
+# include "pathmax.h"
+# include "malloca.h"
+# if HAVE_GETCWD
+# ifdef VMS
+ /* We want the directory in Unix syntax, not in VMS syntax. */
+# define __getcwd(buf, max) getcwd (buf, max, 0)
+# else
+# define __getcwd getcwd
+# endif
+# else
+# define __getcwd(buf, max) getwd (buf)
+# endif
+# define __readlink readlink
+ /* On systems without symbolic links, call stat() instead of lstat(). */
+# if !defined S_ISNLK && !HAVE_READLINK
+# define lstat stat
+# endif
+#endif
+
+/* Return the canonical absolute name of file NAME. A canonical name
+ does not contain any `.', `..' components nor any repeated path
+ separators ('/') or symlinks. All path components must exist. If
+ RESOLVED is null, the result is malloc'd; otherwise, if the
+ canonical name is PATH_MAX chars or more, returns null with `errno'
+ set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
+ returns the name in RESOLVED. If the name cannot be resolved and
+ RESOLVED is non-NULL, it contains the path of the first component
+ that cannot be resolved. If the path can be resolved, RESOLVED
+ holds the same value as the value returned. */
+
+char *
+__realpath (const char *name, char *resolved)
+{
+ char *rpath, *dest, *extra_buf = NULL;
+ const char *start, *end, *rpath_limit;
+ long int path_max;
+#if HAVE_READLINK
+ int num_links = 0;
+#endif
+
+ if (name == NULL)
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ either parameter is a null pointer. We extend this to allow
+ the RESOLVED parameter to be NULL in case the we are expected to
+ allocate the room for the return value. */
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ if (name[0] == '\0')
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ the name argument points to an empty string. */
+ __set_errno (ENOENT);
+ return NULL;
+ }
+
+#ifdef PATH_MAX
+ path_max = PATH_MAX;
+#else
+ path_max = pathconf (name, _PC_PATH_MAX);
+ if (path_max <= 0)
+ path_max = 1024;
+#endif
+
+ if (resolved == NULL)
+ {
+ rpath = malloc (path_max);
+ if (rpath == NULL)
+ {
+ /* It's easier to set errno to ENOMEM than to rely on the
+ 'malloc-posix' gnulib module. */
+ errno = ENOMEM;
+ return NULL;
+ }
+ }
+ else
+ rpath = resolved;
+ rpath_limit = rpath + path_max;
+
+ if (name[0] != '/')
+ {
+ if (!__getcwd (rpath, path_max))
+ {
+ rpath[0] = '\0';
+ goto error;
+ }
+ dest = strchr (rpath, '\0');
+ }
+ else
+ {
+ rpath[0] = '/';
+ dest = rpath + 1;
+ }
+
+ for (start = end = name; *start; start = end)
+ {
+#ifdef _LIBC
+ struct stat64 st;
+#else
+ struct stat st;
+#endif
+
+ /* Skip sequence of multiple path-separators. */
+ while (*start == '/')
+ ++start;
+
+ /* Find end of path component. */
+ for (end = start; *end && *end != '/'; ++end)
+ /* Nothing. */;
+
+ if (end - start == 0)
+ break;
+ else if (end - start == 1 && start[0] == '.')
+ /* nothing */;
+ else if (end - start == 2 && start[0] == '.' && start[1] == '.')
+ {
+ /* Back up to previous component, ignore if at root already. */
+ if (dest > rpath + 1)
+ while ((--dest)[-1] != '/');
+ }
+ else
+ {
+ size_t new_size;
+
+ if (dest[-1] != '/')
+ *dest++ = '/';
+
+ if (dest + (end - start) >= rpath_limit)
+ {
+ ptrdiff_t dest_offset = dest - rpath;
+ char *new_rpath;
+
+ if (resolved)
+ {
+ __set_errno (ENAMETOOLONG);
+ if (dest > rpath + 1)
+ dest--;
+ *dest = '\0';
+ goto error;
+ }
+ new_size = rpath_limit - rpath;
+ if (end - start + 1 > path_max)
+ new_size += end - start + 1;
+ else
+ new_size += path_max;
+ new_rpath = (char *) realloc (rpath, new_size);
+ if (new_rpath == NULL)
+ {
+ /* It's easier to set errno to ENOMEM than to rely on the
+ 'realloc-posix' gnulib module. */
+ errno = ENOMEM;
+ goto error;
+ }
+ rpath = new_rpath;
+ rpath_limit = rpath + new_size;
+
+ dest = rpath + dest_offset;
+ }
+
+#ifdef _LIBC
+ dest = __mempcpy (dest, start, end - start);
+#else
+ memcpy (dest, start, end - start);
+ dest += end - start;
+#endif
+ *dest = '\0';
+
+#ifdef _LIBC
+ if (__lxstat64 (_STAT_VER, rpath, &st) < 0)
+#else
+ if (lstat (rpath, &st) < 0)
+#endif
+ goto error;
+
+#if HAVE_READLINK
+ if (S_ISLNK (st.st_mode))
+ {
+ char *buf;
+ size_t len;
+ int n;
+
+ if (++num_links > MAXSYMLINKS)
+ {
+ __set_errno (ELOOP);
+ goto error;
+ }
+
+ buf = malloca (path_max);
+ if (!buf)
+ {
+ errno = ENOMEM;
+ goto error;
+ }
+
+ n = __readlink (rpath, buf, path_max);
+ if (n < 0)
+ {
+ int saved_errno = errno;
+ freea (buf);
+ errno = saved_errno;
+ goto error;
+ }
+ buf[n] = '\0';
+
+ if (!extra_buf)
+ {
+ extra_buf = malloca (path_max);
+ if (!extra_buf)
+ {
+ freea (buf);
+ errno = ENOMEM;
+ goto error;
+ }
+ }
+
+ len = strlen (end);
+ if ((long int) (n + len) >= path_max)
+ {
+ freea (buf);
+ __set_errno (ENAMETOOLONG);
+ goto error;
+ }
+
+ /* Careful here, end may be a pointer into extra_buf... */
+ memmove (&extra_buf[n], end, len + 1);
+ name = end = memcpy (extra_buf, buf, n);
+
+ if (buf[0] == '/')
+ dest = rpath + 1; /* It's an absolute symlink */
+ else
+ /* Back up to previous component, ignore if at root already: */
+ if (dest > rpath + 1)
+ while ((--dest)[-1] != '/');
+ }
+#endif
+ }
+ }
+ if (dest > rpath + 1 && dest[-1] == '/')
+ --dest;
+ *dest = '\0';
+
+ if (extra_buf)
+ freea (extra_buf);
+
+ return resolved ? memcpy (resolved, rpath, dest - rpath + 1) : rpath;
+
+error:
+ {
+ int saved_errno = errno;
+ if (extra_buf)
+ freea (extra_buf);
+ if (resolved)
+ strcpy (resolved, rpath);
+ else
+ free (rpath);
+ errno = saved_errno;
+ }
+ return NULL;
+}
+#ifdef _LIBC
+versioned_symbol (libc, __realpath, realpath, GLIBC_2_3);
+#endif
+
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3)
+char *
+__old_realpath (const char *name, char *resolved)
+{
+ if (resolved == NULL)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ return __realpath (name, resolved);
+}
+compat_symbol (libc, __old_realpath, realpath, GLIBC_2_0);
+#endif
+
+
+char *
+__canonicalize_file_name (const char *name)
+{
+ return __realpath (name, NULL);
+}
+weak_alias (__canonicalize_file_name, canonicalize_file_name)
+
+#else
+
+/* This declaration is solely to ensure that after preprocessing
+ this file is never empty. */
+typedef int dummy;
+
+#endif
diff --git a/gnulib/lib/canonicalize.c b/gnulib/lib/canonicalize.c
index fa2c1ab9..f0a4762b 100644
--- a/gnulib/lib/canonicalize.c
+++ b/gnulib/lib/canonicalize.c
@@ -1,10 +1,10 @@
/* Return the canonical absolute name of a given file.
Copyright (C) 1996-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,9 +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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
@@ -34,8 +32,9 @@
#include <errno.h>
#include <stddef.h>
-#include "cycle-check.h"
+#include "file-set.h"
#include "filenamecat.h"
+#include "hash-triple.h"
#include "xalloc.h"
#include "xgetcwd.h"
@@ -123,6 +122,30 @@ canonicalize_file_name (const char *name)
}
#endif /* !HAVE_CANONICALIZE_FILE_NAME */
+/* Return true if we've already seen the triple, <FILENAME, dev, ino>.
+ If *HT is not initialized, initialize it. */
+static bool
+seen_triple (Hash_table **ht, char const *filename, struct stat const *st)
+{
+ if (*ht == NULL)
+ {
+ size_t initial_capacity = 7;
+ *ht = hash_initialize (initial_capacity,
+ NULL,
+ triple_hash,
+ triple_compare_ino_str,
+ triple_free);
+ if (*ht == NULL)
+ xalloc_die ();
+ }
+
+ if (seen_file (*ht, filename, st))
+ return true;
+
+ record_file (*ht, filename, st);
+ return false;
+}
+
/* Return the canonical absolute name of file NAME. A canonical name
does not contain any `.', `..' components nor any repeated file name
separators ('/') or symlinks. Whether components must exist
@@ -136,7 +159,7 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode)
char const *end;
char const *rname_limit;
size_t extra_len = 0;
- struct cycle_check_state cycle_state;
+ Hash_table *ht = NULL;
if (name == NULL)
{
@@ -176,7 +199,6 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode)
dest = rname + 1;
}
- cycle_check_init (&cycle_state);
for (start = end = name; *start; start = end)
{
/* Skip sequence of multiple file name separators. */
@@ -237,7 +259,11 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode)
char *buf;
size_t n, len;
- if (cycle_check (&cycle_state, &st))
+ /* Detect loops. We cannot use the cycle-check module here,
+ since it's actually possible to encounter the same symlink
+ more than once in a given traversal. However, encountering
+ the same symlink,NAME pair twice does indicate a loop. */
+ if (seen_triple (&ht, name, &st))
{
__set_errno (ELOOP);
if (can_mode == CAN_MISSING)
@@ -298,10 +324,14 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode)
*dest = '\0';
free (extra_buf);
+ if (ht)
+ hash_free (ht);
return rname;
error:
free (extra_buf);
free (rname);
+ if (ht)
+ hash_free (ht);
return NULL;
}
diff --git a/gnulib/lib/canonicalize.h b/gnulib/lib/canonicalize.h
index 5c4d3f1a..8ca4fb42 100644
--- a/gnulib/lib/canonicalize.h
+++ b/gnulib/lib/canonicalize.h
@@ -1,10 +1,10 @@
/* Return the canonical absolute name of a given file.
Copyright (C) 1996-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,9 +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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef CANONICALIZE_H_
# define CANONICALIZE_H_
diff --git a/gnulib/lib/chdir-long.c b/gnulib/lib/chdir-long.c
new file mode 100644
index 00000000..aeae2526
--- /dev/null
+++ b/gnulib/lib/chdir-long.c
@@ -0,0 +1,264 @@
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+ Copyright (C) 2004, 2005, 2006, 2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "chdir-long.h"
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include "openat.h"
+
+#ifndef PATH_MAX
+# error "compile this file only if your system defines PATH_MAX"
+#endif
+
+struct cd_buf
+{
+ int fd;
+};
+
+static inline void
+cdb_init (struct cd_buf *cdb)
+{
+ cdb->fd = AT_FDCWD;
+}
+
+static inline int
+cdb_fchdir (struct cd_buf const *cdb)
+{
+ return fchdir (cdb->fd);
+}
+
+static inline void
+cdb_free (struct cd_buf const *cdb)
+{
+ if (0 <= cdb->fd)
+ {
+ bool close_fail = close (cdb->fd);
+ assert (! close_fail);
+ }
+}
+
+/* Given a file descriptor of an open directory (or AT_FDCWD), CDB->fd,
+ try to open the CDB->fd-relative directory, DIR. If the open succeeds,
+ update CDB->fd with the resulting descriptor, close the incoming file
+ descriptor, and return zero. Upon failure, return -1 and set errno. */
+static int
+cdb_advance_fd (struct cd_buf *cdb, char const *dir)
+{
+ int new_fd = openat (cdb->fd, dir,
+ O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+ if (new_fd < 0)
+ return -1;
+
+ cdb_free (cdb);
+ cdb->fd = new_fd;
+
+ return 0;
+}
+
+/* Return a pointer to the first non-slash in S. */
+static inline char *
+find_non_slash (char const *s)
+{
+ size_t n_slash = strspn (s, "/");
+ return (char *) s + n_slash;
+}
+
+/* This is a function much like chdir, but without the PATH_MAX limitation
+ on the length of the directory name. A significant difference is that
+ it must be able to modify (albeit only temporarily) the directory
+ name. It handles an arbitrarily long directory name by operating
+ on manageable portions of the name. On systems without the openat
+ syscall, this means changing the working directory to more and more
+ `distant' points along the long directory name and then restoring
+ the working directory. If any of those attempts to save or restore
+ the working directory fails, this function exits nonzero.
+
+ Note that this function may still fail with errno == ENAMETOOLONG, but
+ only if the specified directory name contains a component that is long
+ enough to provoke such a failure all by itself (e.g. if the component
+ has length PATH_MAX or greater on systems that define PATH_MAX). */
+
+int
+chdir_long (char *dir)
+{
+ int e = chdir (dir);
+ if (e == 0 || errno != ENAMETOOLONG)
+ return e;
+
+ {
+ size_t len = strlen (dir);
+ char *dir_end = dir + len;
+ struct cd_buf cdb;
+ size_t n_leading_slash;
+
+ cdb_init (&cdb);
+
+ /* If DIR is the empty string, then the chdir above
+ must have failed and set errno to ENOENT. */
+ assert (0 < len);
+ assert (PATH_MAX <= len);
+
+ /* Count leading slashes. */
+ n_leading_slash = strspn (dir, "/");
+
+ /* Handle any leading slashes as well as any name that matches
+ the regular expression, m!^//hostname[/]*! . Handling this
+ prefix separately usually results in a single additional
+ cdb_advance_fd call, but it's worthwhile, since it makes the
+ code in the following loop cleaner. */
+ if (n_leading_slash == 2)
+ {
+ int err;
+ /* Find next slash.
+ We already know that dir[2] is neither a slash nor '\0'. */
+ char *slash = memchr (dir + 3, '/', dir_end - (dir + 3));
+ if (slash == NULL)
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+ *slash = '\0';
+ err = cdb_advance_fd (&cdb, dir);
+ *slash = '/';
+ if (err != 0)
+ goto Fail;
+ dir = find_non_slash (slash + 1);
+ }
+ else if (n_leading_slash)
+ {
+ if (cdb_advance_fd (&cdb, "/") != 0)
+ goto Fail;
+ dir += n_leading_slash;
+ }
+
+ assert (*dir != '/');
+ assert (dir <= dir_end);
+
+ while (PATH_MAX <= dir_end - dir)
+ {
+ int err;
+ /* Find a slash that is PATH_MAX or fewer bytes away from dir.
+ I.e. see if there is a slash that will give us a name of
+ length PATH_MAX-1 or less. */
+ char *slash = memrchr (dir, '/', PATH_MAX);
+ if (slash == NULL)
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+
+ *slash = '\0';
+ assert (slash - dir < PATH_MAX);
+ err = cdb_advance_fd (&cdb, dir);
+ *slash = '/';
+ if (err != 0)
+ goto Fail;
+
+ dir = find_non_slash (slash + 1);
+ }
+
+ if (dir < dir_end)
+ {
+ if (cdb_advance_fd (&cdb, dir) != 0)
+ goto Fail;
+ }
+
+ if (cdb_fchdir (&cdb) != 0)
+ goto Fail;
+
+ cdb_free (&cdb);
+ return 0;
+
+ Fail:
+ {
+ int saved_errno = errno;
+ cdb_free (&cdb);
+ errno = saved_errno;
+ return -1;
+ }
+ }
+}
+
+#if TEST_CHDIR
+
+# include <stdio.h>
+# include "closeout.h"
+# include "error.h"
+
+char *program_name;
+
+int
+main (int argc, char *argv[])
+{
+ char *line = NULL;
+ size_t n = 0;
+ int len;
+
+ program_name = argv[0];
+ atexit (close_stdout);
+
+ len = getline (&line, &n, stdin);
+ if (len < 0)
+ {
+ int saved_errno = errno;
+ if (feof (stdin))
+ exit (0);
+
+ error (EXIT_FAILURE, saved_errno,
+ "reading standard input");
+ }
+ else if (len == 0)
+ exit (0);
+
+ if (line[len-1] == '\n')
+ line[len-1] = '\0';
+
+ if (chdir_long (line) != 0)
+ error (EXIT_FAILURE, errno,
+ "chdir_long failed: %s", line);
+
+ if (argc <= 1)
+ {
+ /* Using `pwd' here makes sense only if it is a robust implementation,
+ like the one in coreutils after the 2004-04-19 changes. */
+ char const *cmd = "pwd";
+ execlp (cmd, (char *) NULL);
+ error (EXIT_FAILURE, errno, "%s", cmd);
+ }
+
+ fclose (stdin);
+ fclose (stderr);
+
+ exit (EXIT_SUCCESS);
+}
+#endif
+
+/*
+Local Variables:
+compile-command: "gcc -DTEST_CHDIR=1 -g -O -W -Wall chdir-long.c libcoreutils.a"
+End:
+*/
diff --git a/gnulib/lib/chdir-long.h b/gnulib/lib/chdir-long.h
new file mode 100644
index 00000000..5bf0bbc2
--- /dev/null
+++ b/gnulib/lib/chdir-long.h
@@ -0,0 +1,34 @@
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+ Copyright (C) 2004, 2005 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#include <unistd.h>
+#include <limits.h>
+
+#ifndef PATH_MAX
+# ifdef MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# endif
+#endif
+
+/* On systems without PATH_MAX, presume that chdir accepts
+ arbitrarily long directory names. */
+#ifndef PATH_MAX
+# define chdir_long(Dir) chdir (Dir)
+#else
+int chdir_long (char *dir);
+#endif
diff --git a/gnulib/lib/chown.c b/gnulib/lib/chown.c
new file mode 100644
index 00000000..3582b04d
--- /dev/null
+++ b/gnulib/lib/chown.c
@@ -0,0 +1,103 @@
+/* provide consistent interface to chown for systems that don't interpret
+ an ID of -1 as meaning `don't change the corresponding ID'.
+
+ Copyright (C) 1997, 2004, 2005, 2006, 2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#include <stdbool.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+/* Below we refer to the system's chown(). */
+#undef chown
+
+/* The results of open() in this file are not used with fchdir,
+ therefore save some unnecessary work in fchdir.c. */
+#undef open
+#undef close
+
+/* Provide a more-closely POSIX-conforming version of chown on
+ systems with one or both of the following problems:
+ - chown doesn't treat an ID of -1 as meaning
+ `don't change the corresponding ID'.
+ - chown doesn't dereference symlinks. */
+
+int
+rpl_chown (const char *file, uid_t uid, gid_t gid)
+{
+#if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
+ if (gid == (gid_t) -1 || uid == (uid_t) -1)
+ {
+ struct stat file_stats;
+
+ /* Stat file to get id(s) that should remain unchanged. */
+ if (stat (file, &file_stats))
+ return -1;
+
+ if (gid == (gid_t) -1)
+ gid = file_stats.st_gid;
+
+ if (uid == (uid_t) -1)
+ uid = file_stats.st_uid;
+ }
+#endif
+
+#if CHOWN_MODIFIES_SYMLINK
+ {
+ /* Handle the case in which the system-supplied chown function
+ does *not* follow symlinks. Instead, it changes permissions
+ on the symlink itself. To work around that, we open the
+ file (but this can fail due to lack of read or write permission) and
+ use fchown on the resulting descriptor. */
+ int open_flags = O_NONBLOCK | O_NOCTTY;
+ int fd = open (file, O_RDONLY | open_flags);
+ if (0 <= fd
+ || (errno == EACCES
+ && 0 <= (fd = open (file, O_WRONLY | open_flags))))
+ {
+ int result = fchown (fd, uid, gid);
+ int saved_errno = errno;
+
+ /* POSIX says fchown can fail with errno == EINVAL on sockets,
+ so fall back on chown in that case. */
+ struct stat sb;
+ bool fchown_socket_failure =
+ (result != 0 && saved_errno == EINVAL
+ && fstat (fd, &sb) == 0 && S_ISFIFO (sb.st_mode));
+
+ close (fd);
+
+ if (! fchown_socket_failure)
+ {
+ errno = saved_errno;
+ return result;
+ }
+ }
+ else if (errno != EACCES)
+ return -1;
+ }
+#endif
+
+ return chown (file, uid, gid);
+}
diff --git a/gnulib/lib/config.charset b/gnulib/lib/config.charset
index 148ea441..c2337887 100755
--- a/gnulib/lib/config.charset
+++ b/gnulib/lib/config.charset
@@ -1,11 +1,11 @@
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
-# Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000-2004, 2006-2007 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 2, or (at your option)
+# 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,
@@ -31,20 +31,20 @@
#
# name MIME? used by which systems
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin
-# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
-# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
+# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
+# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
# ISO-8859-3 Y glibc solaris
-# ISO-8859-4 Y osf solaris freebsd netbsd darwin
-# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
+# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin
+# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
# ISO-8859-6 Y glibc aix hpux solaris
-# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd darwin
+# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin
# ISO-8859-8 Y glibc aix hpux osf solaris
# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin
-# ISO-8859-13 glibc netbsd darwin
+# ISO-8859-13 glibc netbsd openbsd darwin
# ISO-8859-14 glibc
-# ISO-8859-15 glibc aix osf solaris freebsd darwin
-# KOI8-R Y glibc solaris freebsd netbsd darwin
-# KOI8-U Y glibc freebsd netbsd darwin
+# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin
+# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin
+# KOI8-U Y glibc freebsd netbsd openbsd darwin
# KOI8-T glibc
# CP437 dos
# CP775 dos
@@ -57,7 +57,7 @@
# CP862 dos
# CP864 dos
# CP865 dos
-# CP866 freebsd netbsd darwin dos
+# CP866 freebsd netbsd openbsd darwin dos
# CP869 dos
# CP874 woe32 dos
# CP922 aix
@@ -70,7 +70,7 @@
# CP1125 dos
# CP1129 aix
# CP1250 woe32
-# CP1251 glibc solaris netbsd darwin woe32
+# CP1251 glibc solaris netbsd openbsd darwin woe32
# CP1252 aix woe32
# CP1253 woe32
# CP1254 woe32
@@ -397,6 +397,16 @@ case "$os" in
echo "BIG5 BIG5"
echo "SJIS SHIFT_JIS"
;;
+ openbsd*)
+ echo "646 ASCII"
+ echo "ISO8859-1 ISO-8859-1"
+ echo "ISO8859-2 ISO-8859-2"
+ echo "ISO8859-4 ISO-8859-4"
+ echo "ISO8859-5 ISO-8859-5"
+ echo "ISO8859-7 ISO-8859-7"
+ echo "ISO8859-13 ISO-8859-13"
+ echo "ISO8859-15 ISO-8859-15"
+ ;;
darwin[56]*)
# Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
diff --git a/gnulib/lib/creat-safer.c b/gnulib/lib/creat-safer.c
new file mode 100644
index 00000000..fc314ba4
--- /dev/null
+++ b/gnulib/lib/creat-safer.c
@@ -0,0 +1,31 @@
+/* Invoke creat, but avoid some glitches.
+
+ Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+#include "fcntl-safer.h"
+
+#include <fcntl.h>
+#include "unistd-safer.h"
+
+int
+creat_safer (char const *file, mode_t mode)
+{
+ return fd_safer (creat (file, mode));
+}
diff --git a/gnulib/lib/cycle-check.c b/gnulib/lib/cycle-check.c
deleted file mode 100644
index 5359d71e..00000000
--- a/gnulib/lib/cycle-check.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* help detect directory cycles efficiently
-
- Copyright (C) 2003, 2004, 2005, 2006 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 2, 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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Jim Meyering */
-
-#include <config.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include <stdbool.h>
-
-#include "cycle-check.h"
-
-#define CC_MAGIC 9827862
-
-/* Return true if I is a power of 2, or is zero. */
-
-static inline bool
-is_zero_or_power_of_two (uintmax_t i)
-{
- return (i & (i - 1)) == 0;
-}
-
-void
-cycle_check_init (struct cycle_check_state *state)
-{
- state->chdir_counter = 0;
- state->magic = CC_MAGIC;
-}
-
-/* In traversing a directory hierarchy, call this function once for each
- descending chdir call, with SB corresponding to the chdir operand.
- If SB corresponds to a directory that has already been seen,
- return true to indicate that there is a directory cycle.
- Note that this is done `lazily', which means that some of
- the directories in the cycle may be processed twice before
- the cycle is detected. */
-
-bool
-cycle_check (struct cycle_check_state *state, struct stat const *sb)
-{
- assert (state->magic == CC_MAGIC);
-
- /* If the current directory ever happens to be the same
- as the one we last recorded for the cycle detection,
- then it's obviously part of a cycle. */
- if (state->chdir_counter && SAME_INODE (*sb, state->dev_ino))
- return true;
-
- /* If the number of `descending' chdir calls is a power of two,
- record the dev/ino of the current directory. */
- if (is_zero_or_power_of_two (++(state->chdir_counter)))
- {
- /* On all architectures that we know about, if the counter
- overflows then there is a directory cycle here somewhere,
- even if we haven't detected it yet. Typically this happens
- only after the counter is incremented 2**64 times, so it's a
- fairly theoretical point. */
- if (state->chdir_counter == 0)
- return true;
-
- state->dev_ino.st_dev = sb->st_dev;
- state->dev_ino.st_ino = sb->st_ino;
- }
-
- return false;
-}
diff --git a/gnulib/lib/cycle-check.h b/gnulib/lib/cycle-check.h
deleted file mode 100644
index afd7a8f2..00000000
--- a/gnulib/lib/cycle-check.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* help detect directory cycles efficiently
-
- Copyright (C) 2003, 2004, 2006 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 2, 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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Jim Meyering */
-
-#ifndef CYCLE_CHECK_H
-# define CYCLE_CHECK_H 1
-
-# include <stdint.h>
-# include <stdbool.h>
-# include "dev-ino.h"
-# include "same-inode.h"
-
-struct cycle_check_state
-{
- struct dev_ino dev_ino;
- uintmax_t chdir_counter;
- int magic;
-};
-
-void cycle_check_init (struct cycle_check_state *state);
-bool cycle_check (struct cycle_check_state *state, struct stat const *sb);
-
-# define CYCLE_CHECK_REFLECT_CHDIR_UP(State, SB_dir, SB_subdir) \
- do \
- { \
- /* You must call cycle_check at least once before using this macro. */ \
- if ((State)->chdir_counter == 0) \
- abort (); \
- if (SAME_INODE ((State)->dev_ino, SB_subdir)) \
- { \
- (State)->dev_ino.st_dev = (SB_dir).st_dev; \
- (State)->dev_ino.st_ino = (SB_dir).st_ino; \
- } \
- } \
- while (0)
-
-#endif
diff --git a/gnulib/lib/dev-ino.h b/gnulib/lib/dev-ino.h
deleted file mode 100644
index 695d38c7..00000000
--- a/gnulib/lib/dev-ino.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef DEV_INO_H
-# define DEV_INO_H 1
-
-# include <sys/types.h>
-# include <sys/stat.h>
-
-struct dev_ino
-{
- ino_t st_ino;
- dev_t st_dev;
-};
-
-#endif
diff --git a/gnulib/lib/dirent.in.h b/gnulib/lib/dirent.in.h
new file mode 100644
index 00000000..db3de951
--- /dev/null
+++ b/gnulib/lib/dirent.in.h
@@ -0,0 +1,45 @@
+/* Wrapper around <dirent.h>.
+ Copyright (C) 2006-2007 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _GL_DIRENT_H
+
+/* The include_next requires a split double-inclusion guard. */
+#@INCLUDE_NEXT@ @NEXT_DIRENT_H@
+
+#ifndef _GL_DIRENT_H
+#define _GL_DIRENT_H
+
+
+/* Declare overridden functions. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if @REPLACE_FCHDIR@
+# define opendir rpl_opendir
+extern DIR * opendir (const char *);
+# define closedir rpl_closedir
+extern int closedir (DIR *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _GL_DIRENT_H */
+#endif /* _GL_DIRENT_H */
diff --git a/gnulib/lib/dirfd.c b/gnulib/lib/dirfd.c
index 06cb3c46..18f5154a 100644
--- a/gnulib/lib/dirfd.c
+++ b/gnulib/lib/dirfd.c
@@ -2,10 +2,10 @@
Copyright (C) 2001, 2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */
diff --git a/gnulib/lib/dirfd.h b/gnulib/lib/dirfd.h
index 05b77774..2c2b21d2 100644
--- a/gnulib/lib/dirfd.h
+++ b/gnulib/lib/dirfd.h
@@ -1,10 +1,10 @@
/* Declare dirfd, if necessary.
Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
Written by Jim Meyering. */
diff --git a/gnulib/lib/dirname.c b/gnulib/lib/dirname.c
index 16552c64..c27e5b5d 100644
--- a/gnulib/lib/dirname.c
+++ b/gnulib/lib/dirname.c
@@ -3,10 +3,10 @@
Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -14,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/dirname.h b/gnulib/lib/dirname.h
index 91e7ed33..f592350b 100644
--- a/gnulib/lib/dirname.h
+++ b/gnulib/lib/dirname.h
@@ -2,10 +2,10 @@
Copyright (C) 1998, 2001, 2003-2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef DIRNAME_H_
# define DIRNAME_H_ 1
diff --git a/gnulib/lib/dup-safer.c b/gnulib/lib/dup-safer.c
new file mode 100644
index 00000000..a6908511
--- /dev/null
+++ b/gnulib/lib/dup-safer.c
@@ -0,0 +1,44 @@
+/* Invoke dup, but avoid some glitches.
+
+ Copyright (C) 2001, 2004, 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <config.h>
+
+#include "unistd-safer.h"
+
+#include <fcntl.h>
+
+#include <unistd.h>
+#ifndef STDERR_FILENO
+# define STDERR_FILENO 2
+#endif
+
+/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or
+ STDERR_FILENO. */
+
+int
+dup_safer (int fd)
+{
+#if defined F_DUPFD && !defined FCHDIR_REPLACEMENT
+ return fcntl (fd, F_DUPFD, STDERR_FILENO + 1);
+#else
+ /* fd_safer calls us back, but eventually the recursion unwinds and
+ does the right thing. */
+ return fd_safer (dup (fd));
+#endif
+}
diff --git a/gnulib/lib/dup2.c b/gnulib/lib/dup2.c
new file mode 100644
index 00000000..09990823
--- /dev/null
+++ b/gnulib/lib/dup2.c
@@ -0,0 +1,57 @@
+/* Duplicate an open file descriptor to a specified file descriptor.
+
+ Copyright (C) 1999, 2004, 2005, 2006, 2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+
+#ifndef F_DUPFD
+static int
+dupfd (int fd, int desired_fd)
+{
+ int duplicated_fd = dup (fd);
+ if (duplicated_fd < 0 || duplicated_fd == desired_fd)
+ return duplicated_fd;
+ else
+ {
+ int r = dupfd (fd, desired_fd);
+ int e = errno;
+ close (duplicated_fd);
+ errno = e;
+ return r;
+ }
+}
+#endif
+
+int
+dup2 (int fd, int desired_fd)
+{
+ if (fd == desired_fd)
+ return fd;
+ close (desired_fd);
+#ifdef F_DUPFD
+ return fcntl (fd, F_DUPFD, desired_fd);
+#else
+ return dupfd (fd, desired_fd);
+#endif
+}
diff --git a/gnulib/lib/error.c b/gnulib/lib/error.c
index 9cf67ff9..3177bd5d 100644
--- a/gnulib/lib/error.c
+++ b/gnulib/lib/error.c
@@ -2,19 +2,18 @@
Copyright (C) 1990-1998, 2000-2007 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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
diff --git a/gnulib/lib/error.h b/gnulib/lib/error.h
index 5a5f2476..8c215a7f 100644
--- a/gnulib/lib/error.h
+++ b/gnulib/lib/error.h
@@ -2,19 +2,18 @@
Copyright (C) 1995, 1996, 1997, 2003, 2006 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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _ERROR_H
#define _ERROR_H 1
diff --git a/gnulib/lib/exitfail.c b/gnulib/lib/exitfail.c
index 373d325c..6d1fe4ae 100644
--- a/gnulib/lib/exitfail.c
+++ b/gnulib/lib/exitfail.c
@@ -2,10 +2,10 @@
Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,9 +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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/exitfail.h b/gnulib/lib/exitfail.h
index e46cf9c1..713f2591 100644
--- a/gnulib/lib/exitfail.h
+++ b/gnulib/lib/exitfail.h
@@ -2,10 +2,10 @@
Copyright (C) 2002 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
extern int volatile exit_failure;
diff --git a/gnulib/lib/fchdir.c b/gnulib/lib/fchdir.c
new file mode 100644
index 00000000..246987c8
--- /dev/null
+++ b/gnulib/lib/fchdir.c
@@ -0,0 +1,282 @@
+/* fchdir replacement.
+ Copyright (C) 2006, 2007 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 <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+#include "canonicalize.h"
+#include "dirfd.h"
+
+/* This replacement assumes that a directory is not renamed while opened
+ through a file descriptor. */
+
+/* Array of file descriptors opened. If it points to a directory, it stores
+ info about this directory; otherwise it stores an errno value of ENOTDIR. */
+typedef struct
+{
+ char *name; /* Absolute name of the directory, or NULL. */
+ int saved_errno; /* If name == NULL: The error code describing the failure
+ reason. */
+} dir_info_t;
+static dir_info_t *dirs;
+static size_t dirs_allocated;
+
+/* Try to ensure dirs has enough room for a slot at index fd. */
+static void
+ensure_dirs_slot (size_t fd)
+{
+ if (fd >= dirs_allocated)
+ {
+ size_t new_allocated;
+ dir_info_t *new_dirs;
+ size_t i;
+
+ new_allocated = 2 * dirs_allocated + 1;
+ if (new_allocated <= fd)
+ new_allocated = fd + 1;
+ new_dirs =
+ (dirs != NULL
+ ? (dir_info_t *) realloc (dirs, new_allocated * sizeof (dir_info_t))
+ : (dir_info_t *) malloc (new_allocated * sizeof (dir_info_t)));
+ if (new_dirs != NULL)
+ {
+ for (i = dirs_allocated; i < new_allocated; i++)
+ {
+ new_dirs[i].name = NULL;
+ new_dirs[i].saved_errno = ENOTDIR;
+ }
+ dirs = new_dirs;
+ dirs_allocated = new_allocated;
+ }
+ }
+}
+
+/* Override open() and close(), to keep track of the open file descriptors. */
+
+int
+rpl_close (int fd)
+#undef close
+{
+ int retval = close (fd);
+
+ if (retval >= 0 && fd >= 0 && fd < dirs_allocated)
+ {
+ if (dirs[fd].name != NULL)
+ free (dirs[fd].name);
+ dirs[fd].name = NULL;
+ dirs[fd].saved_errno = ENOTDIR;
+ }
+ return retval;
+}
+
+int
+rpl_open (const char *filename, int flags, ...)
+#undef open
+{
+ mode_t mode;
+ int fd;
+ struct stat statbuf;
+
+ mode = 0;
+ if (flags & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, flags);
+
+ /* If mode_t is narrower than int, use the promoted type (int),
+ not mode_t. Use sizeof to guess whether mode_t is narrower;
+ we don't know of any practical counterexamples. */
+ mode = (sizeof (mode_t) < sizeof (int)
+ ? va_arg (arg, int)
+ : va_arg (arg, mode_t));
+
+ va_end (arg);
+ }
+#if defined GNULIB_OPEN && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+ if (strcmp (filename, "/dev/null") == 0)
+ filename = "NUL";
+#endif
+ fd = open (filename, flags, mode);
+ if (fd >= 0)
+ {
+ ensure_dirs_slot (fd);
+ if (fd < dirs_allocated
+ && fstat (fd, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
+ {
+ dirs[fd].name = canonicalize_file_name (filename);
+ if (dirs[fd].name == NULL)
+ dirs[fd].saved_errno = errno;
+ }
+ }
+ return fd;
+}
+
+/* Override opendir() and closedir(), to keep track of the open file
+ descriptors. Needed because there is a function dirfd(). */
+
+int
+rpl_closedir (DIR *dp)
+#undef closedir
+{
+ int fd = dirfd (dp);
+ int retval = closedir (dp);
+
+ if (retval >= 0 && fd >= 0 && fd < dirs_allocated)
+ {
+ if (dirs[fd].name != NULL)
+ free (dirs[fd].name);
+ dirs[fd].name = NULL;
+ dirs[fd].saved_errno = ENOTDIR;
+ }
+ return retval;
+}
+
+DIR *
+rpl_opendir (const char *filename)
+#undef opendir
+{
+ DIR *dp;
+
+ dp = opendir (filename);
+ if (dp != NULL)
+ {
+ int fd = dirfd (dp);
+ if (fd >= 0)
+ {
+ ensure_dirs_slot (fd);
+ if (fd < dirs_allocated)
+ {
+ dirs[fd].name = canonicalize_file_name (filename);
+ if (dirs[fd].name == NULL)
+ dirs[fd].saved_errno = errno;
+ }
+ }
+ }
+ return dp;
+}
+
+/* Override dup() and dup2(), to keep track of open file descriptors. */
+
+int
+rpl_dup (int oldfd)
+#undef dup
+{
+ int newfd = dup (oldfd);
+
+ if (oldfd >= 0 && newfd >= 0)
+ {
+ ensure_dirs_slot (newfd);
+ if (newfd < dirs_allocated)
+ {
+ if (oldfd < dirs_allocated)
+ {
+ if (dirs[oldfd].name != NULL)
+ {
+ dirs[newfd].name = strdup (dirs[oldfd].name);
+ if (dirs[newfd].name == NULL)
+ dirs[newfd].saved_errno = ENOMEM;
+ }
+ else
+ {
+ dirs[newfd].name = NULL;
+ dirs[newfd].saved_errno = dirs[oldfd].saved_errno;
+ }
+ }
+ else
+ {
+ dirs[newfd].name = NULL;
+ dirs[newfd].saved_errno = ENOMEM;
+ }
+ }
+ }
+ return newfd;
+}
+
+int
+rpl_dup2 (int oldfd, int newfd)
+#undef dup2
+{
+ int retval = dup2 (oldfd, newfd);
+
+ if (retval >= 0 && oldfd >= 0 && newfd >= 0 && newfd != oldfd)
+ {
+ ensure_dirs_slot (newfd);
+ if (newfd < dirs_allocated)
+ {
+ if (oldfd < dirs_allocated)
+ {
+ if (dirs[oldfd].name != NULL)
+ {
+ dirs[newfd].name = strdup (dirs[oldfd].name);
+ if (dirs[newfd].name == NULL)
+ dirs[newfd].saved_errno = ENOMEM;
+ }
+ else
+ {
+ dirs[newfd].name = NULL;
+ dirs[newfd].saved_errno = dirs[oldfd].saved_errno;
+ }
+ }
+ else
+ {
+ dirs[newfd].name = NULL;
+ dirs[newfd].saved_errno = ENOMEM;
+ }
+ }
+ }
+ return retval;
+}
+
+/* Implement fchdir() in terms of chdir(). */
+
+int
+fchdir (int fd)
+{
+ if (fd >= 0)
+ {
+ if (fd < dirs_allocated)
+ {
+ if (dirs[fd].name != NULL)
+ return chdir (dirs[fd].name);
+ else
+ {
+ errno = dirs[fd].saved_errno;
+ return -1;
+ }
+ }
+ else
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+ }
+ else
+ {
+ errno = EBADF;
+ return -1;
+ }
+}
diff --git a/gnulib/lib/fchmodat.c b/gnulib/lib/fchmodat.c
new file mode 100644
index 00000000..935bdcbc
--- /dev/null
+++ b/gnulib/lib/fchmodat.c
@@ -0,0 +1,49 @@
+/* Change the protections of file relative to an open directory.
+ Copyright (C) 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "openat.h"
+#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "save-cwd.h"
+#include "openat-priv.h"
+
+#ifndef HAVE_LCHMOD
+/* Use a different name, to avoid conflicting with any
+ system-supplied declaration. */
+# undef lchmod
+# define lchmod lchmod_rpl
+static int lchmod (char const *f, mode_t m) { errno = ENOSYS; return -1; }
+#endif
+
+/* Solaris 10 has no function like this.
+ Invoke chmod or lchmod on file, FILE, using mode MODE, in the directory
+ open on descriptor FD. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ then mkdir/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero.
+ Note that an attempt to use a FLAG value of AT_SYMLINK_NOFOLLOW
+ on a system without lchmod support causes this function to fail. */
+
+#define AT_FUNC_NAME fchmodat
+#define AT_FUNC_F1 lchmod
+#define AT_FUNC_F2 chmod
+#define AT_FUNC_USE_F1_COND flag == AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode, int flag
+#define AT_FUNC_POST_FILE_ARGS , mode
+#include "at-func.c"
diff --git a/gnulib/lib/fchown-stub.c b/gnulib/lib/fchown-stub.c
new file mode 100644
index 00000000..6be750b8
--- /dev/null
+++ b/gnulib/lib/fchown-stub.c
@@ -0,0 +1,16 @@
+#include <config.h>
+
+#include <sys/types.h>
+#include <errno.h>
+
+/* A trivial substitute for `fchown'.
+
+ DJGPP 2.03 and earlier (and perhaps later) don't have `fchown',
+ so we pretend no-one has permission for this operation. */
+
+int
+fchown (int fd, uid_t uid, gid_t gid)
+{
+ errno = EPERM;
+ return -1;
+}
diff --git a/gnulib/lib/fchownat.c b/gnulib/lib/fchownat.c
new file mode 100644
index 00000000..a1d5e60f
--- /dev/null
+++ b/gnulib/lib/fchownat.c
@@ -0,0 +1,48 @@
+/* This function serves as replacement for a missing fchownat function,
+ as well as a work around for the fchownat bug in glibc-2.4:
+ <http://lists.ubuntu.com/archives/ubuntu-users/2006-September/093218.html>
+ when the buggy fchownat-with-AT_SYMLINK_NOFOLLOW operates on a symlink, it
+ mistakenly affects the symlink referent, rather than the symlink itself.
+
+ Copyright (C) 2006-2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "openat.h"
+
+#include <unistd.h>
+
+#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "save-cwd.h"
+#include "openat-priv.h"
+
+/* Replacement for Solaris' function by the same name.
+ Invoke chown or lchown on file, FILE, using OWNER and GROUP, in the
+ directory open on descriptor FD. If FLAG is AT_SYMLINK_NOFOLLOW, then
+ use lchown, otherwise, use chown. If possible, do it without changing
+ the working directory. Otherwise, resort to using save_cwd/fchdir,
+ then mkdir/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero. */
+
+#define AT_FUNC_NAME fchownat
+#define AT_FUNC_F1 lchown
+#define AT_FUNC_F2 chown
+#define AT_FUNC_USE_F1_COND flag == AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group, int flag
+#define AT_FUNC_POST_FILE_ARGS , owner, group
+#include "at-func.c"
diff --git a/gnulib/lib/fcntl--.h b/gnulib/lib/fcntl--.h
new file mode 100644
index 00000000..5a6a8792
--- /dev/null
+++ b/gnulib/lib/fcntl--.h
@@ -0,0 +1,27 @@
+/* Like fcntl.h, but redefine some names to avoid glitches.
+
+ Copyright (C) 2005 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <fcntl.h>
+#include "fcntl-safer.h"
+
+#undef open
+#define open open_safer
+
+#undef creat
+#define creat creat_safer
diff --git a/gnulib/lib/fcntl-safer.h b/gnulib/lib/fcntl-safer.h
new file mode 100644
index 00000000..99f38656
--- /dev/null
+++ b/gnulib/lib/fcntl-safer.h
@@ -0,0 +1,23 @@
+/* Invoke fcntl-like functions, but avoid some glitches.
+
+ Copyright (C) 2005 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <sys/types.h>
+
+int open_safer (char const *, int, ...);
+int creat_safer (char const *, mode_t);
diff --git a/gnulib/lib/fcntl.in.h b/gnulib/lib/fcntl.in.h
new file mode 100644
index 00000000..066a26c7
--- /dev/null
+++ b/gnulib/lib/fcntl.in.h
@@ -0,0 +1,120 @@
+/* Like <fcntl.h>, but with non-working flags defined to 0.
+
+ Copyright (C) 2006-2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Paul Eggert */
+
+#ifndef _GL_FCNTL_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+/* The include_next requires a split double-inclusion guard. */
+#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
+
+#ifndef _GL_FCNTL_H
+#define _GL_FCNTL_H
+
+
+/* Declare overridden functions. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if (@GNULIB_OPEN@ && @REPLACE_OPEN@) || defined FCHDIR_REPLACEMENT
+# define open rpl_open
+extern int open (const char *filename, int flags, ...);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/* Fix up the O_* macros. */
+
+#if !defined O_DIRECT && defined O_DIRECTIO
+/* Tru64 spells it `O_DIRECTIO'. */
+# define O_DIRECT O_DIRECTIO
+#endif
+
+#ifndef O_DIRECT
+# define O_DIRECT 0
+#endif
+
+#ifndef O_DIRECTORY
+# define O_DIRECTORY 0
+#endif
+
+#ifndef O_DSYNC
+# define O_DSYNC 0
+#endif
+
+#ifndef O_NDELAY
+# define O_NDELAY 0
+#endif
+
+#ifndef O_NOATIME
+# define O_NOATIME 0
+#endif
+
+#ifndef O_NONBLOCK
+# define O_NONBLOCK O_NDELAY
+#endif
+
+#ifndef O_NOCTTY
+# define O_NOCTTY 0
+#endif
+
+#ifndef O_NOFOLLOW
+# define O_NOFOLLOW 0
+#endif
+
+#ifndef O_NOLINKS
+# define O_NOLINKS 0
+#endif
+
+#ifndef O_RSYNC
+# define O_RSYNC 0
+#endif
+
+#ifndef O_SYNC
+# define O_SYNC 0
+#endif
+
+/* For systems that distinguish between text and binary I/O.
+ O_BINARY is usually declared in fcntl.h */
+#if !defined O_BINARY && defined _O_BINARY
+ /* For MSC-compatible compilers. */
+# define O_BINARY _O_BINARY
+# define O_TEXT _O_TEXT
+#endif
+
+#ifdef __BEOS__
+ /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
+# undef O_BINARY
+# undef O_TEXT
+#endif
+
+#ifndef O_BINARY
+# define O_BINARY 0
+# define O_TEXT 0
+#endif
+
+
+#endif /* _GL_FCNTL_H */
+#endif /* _GL_FCNTL_H */
diff --git a/gnulib/lib/fd-safer.c b/gnulib/lib/fd-safer.c
new file mode 100644
index 00000000..df38c8f7
--- /dev/null
+++ b/gnulib/lib/fd-safer.c
@@ -0,0 +1,56 @@
+/* Return a safer copy of a file descriptor.
+
+ Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <config.h>
+
+#include "unistd-safer.h"
+
+#include <errno.h>
+
+#include <unistd.h>
+#ifndef STDIN_FILENO
+# define STDIN_FILENO 0
+#endif
+#ifndef STDERR_FILENO
+# define STDERR_FILENO 2
+#endif
+
+/* Return FD, unless FD would be a copy of standard input, output, or
+ error; in that case, return a duplicate of FD, closing FD. On
+ failure to duplicate, close FD, set errno, and return -1. Preserve
+ errno if FD is negative, so that the caller can always inspect
+ errno when the returned value is negative.
+
+ This function is usefully wrapped around functions that return file
+ descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */
+
+int
+fd_safer (int fd)
+{
+ if (STDIN_FILENO <= fd && fd <= STDERR_FILENO)
+ {
+ int f = dup_safer (fd);
+ int e = errno;
+ close (fd);
+ errno = e;
+ fd = f;
+ }
+
+ return fd;
+}
diff --git a/gnulib/lib/file-set.c b/gnulib/lib/file-set.c
new file mode 100644
index 00000000..46dcf5fb
--- /dev/null
+++ b/gnulib/lib/file-set.c
@@ -0,0 +1,74 @@
+/* Specialized functions to manipulate a set of files.
+ Copyright (C) 2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+#include "file-set.h"
+
+#include "hash-triple.h"
+#include "xalloc.h"
+
+/* Record file, FILE, and dev/ino from *STATS, in the hash table, HT.
+ If HT is NULL, return immediately.
+ If memory allocation fails, exit immediately. */
+void
+record_file (Hash_table *ht, char const *file, struct stat const *stats)
+{
+ struct F_triple *ent;
+
+ if (ht == NULL)
+ return;
+
+ ent = xmalloc (sizeof *ent);
+ ent->name = xstrdup (file);
+ ent->st_ino = stats->st_ino;
+ ent->st_dev = stats->st_dev;
+
+ {
+ struct F_triple *ent_from_table = hash_insert (ht, ent);
+ if (ent_from_table == NULL)
+ {
+ /* Insertion failed due to lack of memory. */
+ xalloc_die ();
+ }
+
+ if (ent_from_table != ent)
+ {
+ /* There was alread a matching entry in the table, so ENT was
+ not inserted. Free it. */
+ triple_free (ent);
+ }
+ }
+}
+
+/* Return true if there is an entry in hash table, HT,
+ for the file described by FILE and STATS. */
+bool
+seen_file (Hash_table const *ht, char const *file,
+ struct stat const *stats)
+{
+ struct F_triple new_ent;
+
+ if (ht == NULL)
+ return false;
+
+ new_ent.name = (char *) file;
+ new_ent.st_ino = stats->st_ino;
+ new_ent.st_dev = stats->st_dev;
+
+ return !!hash_lookup (ht, &new_ent);
+}
diff --git a/gnulib/lib/file-set.h b/gnulib/lib/file-set.h
new file mode 100644
index 00000000..a5a159e9
--- /dev/null
+++ b/gnulib/lib/file-set.h
@@ -0,0 +1,12 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdbool.h>
+
+#include "hash.h"
+
+extern void record_file (Hash_table *ht, char const *file,
+ struct stat const *stats)
+ __attribute__((nonnull(2, 3)));
+
+extern bool seen_file (Hash_table const *ht, char const *file,
+ struct stat const *stats);
diff --git a/gnulib/lib/filenamecat.c b/gnulib/lib/filenamecat.c
index beac5c18..ef46de20 100644
--- a/gnulib/lib/filenamecat.c
+++ b/gnulib/lib/filenamecat.c
@@ -2,10 +2,10 @@
Copyright (C) 1996-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */
@@ -101,40 +100,3 @@ file_name_concat (char const *dir, char const *abase, char **base_in_result)
xalloc_die ();
return p;
}
-
-#ifdef TEST_FILE_NAME_CONCAT
-# include <stdlib.h>
-# include <stdio.h>
-int
-main ()
-{
- static char const *const tests[][3] =
- {
- {"a", "b", "a/b"},
- {"a/", "b", "a/b"},
- {"a/", "/b", "a/b"},
- {"a", "/b", "a/b"},
-
- {"/", "b", "/b"},
- {"/", "/b", "/b"},
- {"/", "/", "/"},
- {"a", "/", "a/"}, /* this might deserve a diagnostic */
- {"/a", "/", "/a/"}, /* this might deserve a diagnostic */
- {"a", "//b", "a/b"},
- };
- size_t i;
- bool fail = false;
- for (i = 0; i < sizeof tests / sizeof tests[0]; i++)
- {
- char *base_in_result;
- char const *const *t = tests[i];
- char *res = file_name_concat (t[0], t[1], &base_in_result);
- if (strcmp (res, t[2]) != 0)
- {
- printf ("got %s, expected %s\n", res, t[2]);
- fail = true;
- }
- }
- exit (fail ? EXIT_FAILURE : EXIT_SUCCESS);
-}
-#endif
diff --git a/gnulib/lib/filenamecat.h b/gnulib/lib/filenamecat.h
index 28f8c3fb..334c887c 100644
--- a/gnulib/lib/filenamecat.h
+++ b/gnulib/lib/filenamecat.h
@@ -2,10 +2,10 @@
Copyright (C) 1996, 1997, 2003, 2005, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */
diff --git a/gnulib/lib/float+.h b/gnulib/lib/float+.h
index 4de25a94..240fe365 100644
--- a/gnulib/lib/float+.h
+++ b/gnulib/lib/float+.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/float_.h b/gnulib/lib/float.in.h
index d61d630b..986719b5 100644
--- a/gnulib/lib/float_.h
+++ b/gnulib/lib/float.in.h
@@ -2,10 +2,10 @@
Copyright (C) 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_FLOAT_H
diff --git a/gnulib/lib/fnmatch.c b/gnulib/lib/fnmatch.c
index 48bc8b5d..676e1bd8 100644
--- a/gnulib/lib/fnmatch.c
+++ b/gnulib/lib/fnmatch.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/fnmatch_.h b/gnulib/lib/fnmatch.in.h
index b086b45a..3518c298 100644
--- a/gnulib/lib/fnmatch_.h
+++ b/gnulib/lib/fnmatch.in.h
@@ -5,7 +5,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/fnmatch_loop.c b/gnulib/lib/fnmatch_loop.c
index d1008c24..337fba9d 100644
--- a/gnulib/lib/fnmatch_loop.c
+++ b/gnulib/lib/fnmatch_loop.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/fstatat.c b/gnulib/lib/fstatat.c
new file mode 100644
index 00000000..8b629122
--- /dev/null
+++ b/gnulib/lib/fstatat.c
@@ -0,0 +1,56 @@
+/* Work around an fstatat bug on Solaris 9.
+
+ Copyright (C) 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert and Jim Meyering. */
+
+#include <config.h>
+
+#define COMPILING_FSTATAT 1
+#include "openat.h"
+
+#include <errno.h>
+#include <string.h>
+
+/* fstatat should always follow symbolic links that end in /, but on
+ Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified. This is
+ the same problem that lstat.c addresses, so solve it in a similar
+ way. */
+
+int
+rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
+{
+ int result = fstatat (fd, file, st, flag);
+
+ if (result == 0 && (flag & AT_SYMLINK_NOFOLLOW) && S_ISLNK (st->st_mode)
+ && file[strlen (file) - 1] == '/')
+ {
+ /* FILE refers to a symbolic link and the name ends with a slash.
+ Get info about the link's referent. */
+ result = fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW);
+ if (result == 0 && ! S_ISDIR (st->st_mode))
+ {
+ /* fstatat succeeded and FILE references a non-directory.
+ But it was specified via a name including a trailing
+ slash. Fail with errno set to ENOTDIR to indicate the
+ contradiction. */
+ errno = ENOTDIR;
+ return -1;
+ }
+ }
+
+ return result;
+}
diff --git a/gnulib/lib/getcwd.c b/gnulib/lib/getcwd.c
index 23b35de6..b8e9989b 100644
--- a/gnulib/lib/getcwd.c
+++ b/gnulib/lib/getcwd.c
@@ -2,19 +2,18 @@
Foundation, Inc.
This file is part of the GNU C Library.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
# include <config.h>
@@ -90,7 +89,7 @@
#endif
#if !_LIBC
-# define __getcwd getcwd
+# define __getcwd rpl_getcwd
# define __lstat lstat
# define __closedir closedir
# define __opendir opendir
diff --git a/gnulib/lib/getlogin_r.c b/gnulib/lib/getlogin_r.c
index bb89f6e6..dbd23050 100644
--- a/gnulib/lib/getlogin_r.c
+++ b/gnulib/lib/getlogin_r.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
@@ -30,7 +30,7 @@
char *getlogin (void);
#endif
-/* See unistd_.h for documentation. */
+/* See unistd.in.h for documentation. */
int
getlogin_r (char *name, size_t size)
{
diff --git a/gnulib/lib/getopt.c b/gnulib/lib/getopt.c
index 3580ad82..3c236019 100644
--- a/gnulib/lib/getopt.c
+++ b/gnulib/lib/getopt.c
@@ -6,19 +6,18 @@
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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>
diff --git a/gnulib/lib/getopt_.h b/gnulib/lib/getopt.in.h
index 615ef9a3..d2d3e6e6 100644
--- a/gnulib/lib/getopt_.h
+++ b/gnulib/lib/getopt.in.h
@@ -3,19 +3,18 @@
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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GETOPT_H
diff --git a/gnulib/lib/getopt1.c b/gnulib/lib/getopt1.c
index cc0746ea..d6a3ecf4 100644
--- a/gnulib/lib/getopt1.c
+++ b/gnulib/lib/getopt1.c
@@ -3,19 +3,18 @@
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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef _LIBC
# include <getopt.h>
diff --git a/gnulib/lib/getopt_int.h b/gnulib/lib/getopt_int.h
index 401579fd..3c6628bb 100644
--- a/gnulib/lib/getopt_int.h
+++ b/gnulib/lib/getopt_int.h
@@ -3,19 +3,18 @@
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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GETOPT_INT_H
#define _GETOPT_INT_H 1
diff --git a/gnulib/lib/gettext.h b/gnulib/lib/gettext.h
index 9d76ec9a..763dd3c1 100644
--- a/gnulib/lib/gettext.h
+++ b/gnulib/lib/gettext.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/gettimeofday.c b/gnulib/lib/gettimeofday.c
index bd5576cb..88295ce6 100644
--- a/gnulib/lib/gettimeofday.c
+++ b/gnulib/lib/gettimeofday.c
@@ -5,7 +5,7 @@
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 2, or (at your option)
+ 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,
@@ -48,7 +48,7 @@ static struct tm *localtime_buffer_addr = &tm_zero_buffer;
localtime uses for its result. */
struct tm *
-localtime (time_t const *timep)
+rpl_localtime (time_t const *timep)
{
#undef localtime
extern struct tm *localtime (time_t const *);
@@ -62,7 +62,7 @@ localtime (time_t const *timep)
/* Same as above, since gmtime and localtime use the same buffer. */
struct tm *
-gmtime (time_t const *timep)
+rpl_gmtime (time_t const *timep)
{
#undef gmtime
extern struct tm *gmtime (time_t const *);
@@ -80,7 +80,7 @@ gmtime (time_t const *timep)
/* This is a wrapper for tzset, for systems on which tzset may clobber
the static buffer used for localtime's result. */
void
-tzset (void)
+rpl_tzset (void)
{
#undef tzset
extern void tzset (void);
diff --git a/gnulib/lib/glob-libc.h b/gnulib/lib/glob-libc.h
index 26a131a0..2f7b750c 100644
--- a/gnulib/lib/glob-libc.h
+++ b/gnulib/lib/glob-libc.h
@@ -2,16 +2,16 @@
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
+ modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+ 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
Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
+ You should have received a copy of the GNU General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
diff --git a/gnulib/lib/glob.c b/gnulib/lib/glob.c
index e8b79ffa..42009255 100644
--- a/gnulib/lib/glob.c
+++ b/gnulib/lib/glob.c
@@ -1,17 +1,18 @@
-/* Copyright (C) 1991-2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
+ modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+ 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
Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
+ You should have received a copy of the GNU General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
@@ -133,6 +134,7 @@
# define struct_stat64 struct stat64
#else /* !_LIBC */
# define __stat64(fname, buf) stat (fname, buf)
+# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
# define struct_stat64 struct stat
# define __stat(fname, buf) stat (fname, buf)
# define __alloca alloca
@@ -141,9 +143,13 @@
# define __glob_pattern_p glob_pattern_p
#endif /* _LIBC */
-#include <stdbool.h>
#include <fnmatch.h>
+#ifndef _LIBC
+# include "dirfd.h"
+# include "openat.h"
+#endif
+
#ifdef _SC_GETPW_R_SIZE_MAX
# define GETPW_R_SIZE_MAX() sysconf (_SC_GETPW_R_SIZE_MAX)
#else
@@ -159,14 +165,45 @@ static const char *next_brace_sub (const char *begin, int flags) __THROW;
#endif /* !defined _LIBC || !defined GLOB_ONLY_P */
+#ifndef attribute_hidden
+# define attribute_hidden
+#endif
+
+#ifndef __attribute_noinline__
+# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)
+# define __attribute_noinline__ /* Ignore */
+#else
+# define __attribute_noinline__ __attribute__ ((__noinline__))
+# endif
+#endif
+
+#if ! defined __builtin_expect && __GNUC__ < 3
+# define __builtin_expect(expr, expected) (expr)
+#endif
+
+#ifndef _LIBC
/* The results of opendir() in this file are not used with dirfd and fchdir,
therefore save some unnecessary work in fchdir.c. */
-#undef opendir
-#undef closedir
+# undef opendir
+# undef closedir
+
+# 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. */
+# define __libc_use_alloca(n) ((n) < 4032)
+# else
+/* alloca is implemented with malloc, so just use malloc. */
+# define __libc_use_alloca(n) 0
+# endif
+#endif
static int glob_in_dir (const char *pattern, const char *directory,
int flags, int (*errfunc) (const char *, int),
glob_t *pglob);
+extern int __glob_pattern_type (const char *pattern, int quote)
+ attribute_hidden;
#if !defined _LIBC || !defined GLOB_ONLY_P
static int prefix_array (const char *prefix, char **array, size_t n) __THROW;
@@ -222,6 +259,9 @@ glob (pattern, flags, errfunc, pglob)
size_t dirlen;
int status;
size_t oldcount;
+ int meta;
+ int dirname_modified;
+ glob_t dirs;
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
{
@@ -390,6 +430,7 @@ glob (pattern, flags, errfunc, pglob)
if (filename == NULL)
filename = strchr (pattern, ':');
#endif /* __MSDOS__ || WINDOWS32 */
+ dirname_modified = 0;
if (filename == NULL)
{
/* This can mean two things: a simple name or "~name". The latter
@@ -415,9 +456,11 @@ glob (pattern, flags, errfunc, pglob)
dirlen = 0;
}
}
- else if (filename == pattern)
+ else if (filename == pattern
+ || (filename == pattern + 1 && pattern[0] == '\\'
+ && (flags & GLOB_NOESCAPE) == 0))
{
- /* "/pattern". */
+ /* "/pattern" or "\\/pattern". */
dirname = "/";
dirlen = 1;
++filename;
@@ -458,10 +501,33 @@ glob (pattern, flags, errfunc, pglob)
&& dirlen > 1)
/* "pattern/". Expand "pattern", appending slashes. */
{
- int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
+ int orig_flags = flags;
+ int val;
+ if (!(flags & GLOB_NOESCAPE) && dirname[dirlen - 1] == '\\')
+ {
+ /* "pattern\\/". Remove the final backslash if it hasn't
+ been quoted. */
+ char *p = (char *) &dirname[dirlen - 1];
+
+ while (p > dirname && p[-1] == '\\') --p;
+ if ((&dirname[dirlen] - p) & 1)
+ {
+ *(char *) &dirname[--dirlen] = '\0';
+ flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC);
+ }
+ }
+ val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
if (val == 0)
pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
| (flags & GLOB_MARK));
+ else if (val == GLOB_NOMATCH && flags != orig_flags)
+ {
+ /* Make sure globfree (&dirs); is a nop. */
+ dirs.gl_pathv = NULL;
+ flags = orig_flags;
+ oldcount = pglob->gl_pathc + pglob->gl_offs;
+ goto no_matches;
+ }
return val;
}
}
@@ -487,7 +553,9 @@ glob (pattern, flags, errfunc, pglob)
if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~')
{
- if (dirname[1] == '\0' || dirname[1] == '/')
+ if (dirname[1] == '\0' || dirname[1] == '/'
+ || (!(flags & GLOB_NOESCAPE) && dirname[1] == '\\'
+ && (dirname[2] == '\0' || dirname[2] == '/')))
{
/* Look up home directory. */
const char *home_dir = getenv ("HOME");
@@ -564,7 +632,10 @@ glob (pattern, flags, errfunc, pglob)
# endif
/* Now construct the full directory. */
if (dirname[1] == '\0')
- dirname = home_dir;
+ {
+ dirname = home_dir;
+ dirlen = strlen (dirname);
+ }
else
{
char *newp;
@@ -573,7 +644,9 @@ glob (pattern, flags, errfunc, pglob)
mempcpy (mempcpy (newp, home_dir, home_len),
&dirname[1], dirlen);
dirname = newp;
+ dirlen += home_len - 1;
}
+ dirname_modified = 1;
}
# if !defined _AMIGA && !defined WINDOWS32
else
@@ -581,7 +654,19 @@ glob (pattern, flags, errfunc, pglob)
char *end_name = strchr (dirname, '/');
const char *user_name;
const char *home_dir;
+ char *unescape = NULL;
+ if (!(flags & GLOB_NOESCAPE))
+ {
+ if (end_name == NULL)
+ {
+ unescape = strchr (dirname, '\\');
+ if (unescape)
+ end_name = strchr (unescape, '\0');
+ }
+ else
+ unescape = memchr (dirname, '\\', end_name - dirname);
+ }
if (end_name == NULL)
user_name = dirname + 1;
else
@@ -590,6 +675,33 @@ glob (pattern, flags, errfunc, pglob)
newp = __alloca (end_name - dirname);
*((char *) mempcpy (newp, dirname + 1, end_name - dirname))
= '\0';
+ if (unescape != NULL)
+ {
+ char *p = mempcpy (newp, dirname + 1,
+ unescape - dirname - 1);
+ char *q = unescape;
+ while (*q != '\0')
+ {
+ if (*q == '\\')
+ {
+ if (q[1] == '\0')
+ {
+ /* "~fo\\o\\" unescape to user_name "foo\\",
+ but "~fo\\o\\/" unescape to user_name
+ "foo". */
+ if (filename == NULL)
+ *p++ = '\\';
+ break;
+ }
+ ++q;
+ }
+ *p++ = *q++;
+ }
+ *p = '\0';
+ }
+ else
+ *((char *) mempcpy (newp, dirname + 1, end_name - dirname))
+ = '\0';
user_name = newp;
}
@@ -643,6 +755,8 @@ glob (pattern, flags, errfunc, pglob)
*((char *) mempcpy (mempcpy (newp, home_dir, home_len),
end_name, rest_len)) = '\0';
dirname = newp;
+ dirlen = home_len + rest_len;
+ dirname_modified = 1;
}
else
if (flags & GLOB_TILDE_CHECK)
@@ -662,7 +776,7 @@ glob (pattern, flags, errfunc, pglob)
/* Return the directory if we don't check for error or if it exists. */
if ((flags & GLOB_NOCHECK)
- || (((flags & GLOB_ALTDIRFUNC)
+ || (((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
? ((*pglob->gl_stat) (dirname, &st) == 0
&& S_ISDIR (st.st_mode))
: (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode)))))
@@ -682,9 +796,22 @@ glob (pattern, flags, errfunc, pglob)
}
pglob->gl_pathv = new_gl_pathv;
- pglob->gl_pathv[newcount] = strdup (dirname);
- if (pglob->gl_pathv[newcount] == NULL)
- goto nospace;
+ if (flags & GLOB_MARK)
+ {
+ char *p;
+ pglob->gl_pathv[newcount] = malloc (dirlen + 2);
+ if (pglob->gl_pathv[newcount] == NULL)
+ goto nospace;
+ p = mempcpy (pglob->gl_pathv[newcount], dirname, dirlen);
+ p[0] = '/';
+ p[1] = '\0';
+ }
+ else
+ {
+ pglob->gl_pathv[newcount] = strdup (dirname);
+ if (pglob->gl_pathv[newcount] == NULL)
+ goto nospace;
+ }
pglob->gl_pathv[++newcount] = NULL;
++pglob->gl_pathc;
pglob->gl_flags = flags;
@@ -696,15 +823,31 @@ glob (pattern, flags, errfunc, pglob)
return GLOB_NOMATCH;
}
- if (__glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE)))
+ meta = __glob_pattern_type (dirname, !(flags & GLOB_NOESCAPE));
+ /* meta is 1 if correct glob pattern containing metacharacters.
+ If meta has bit (1 << 2) set, it means there was an unterminated
+ [ which we handle the same, using fnmatch. Broken unterminated
+ pattern bracket expressions ought to be rare enough that it is
+ not worth special casing them, fnmatch will do the right thing. */
+ if (meta & 5)
{
/* The directory name contains metacharacters, so we
have to glob for the directory, and then glob for
the pattern in each directory found. */
- glob_t dirs;
size_t i;
- if ((flags & GLOB_ALTDIRFUNC) != 0)
+ if (!(flags & GLOB_NOESCAPE) && dirlen > 0 && dirname[dirlen - 1] == '\\')
+ {
+ /* "foo\\/bar". Remove the final backslash from dirname
+ if it has not been quoted. */
+ char *p = (char *) &dirname[dirlen - 1];
+
+ while (p > dirname && p[-1] == '\\') --p;
+ if ((&dirname[dirlen] - p) & 1)
+ *(char *) &dirname[--dirlen] = '\0';
+ }
+
+ if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) != 0, 0))
{
/* Use the alternative access functions also in the recursive
call. */
@@ -716,12 +859,16 @@ glob (pattern, flags, errfunc, pglob)
}
status = glob (dirname,
- ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE
+ ((flags & (GLOB_ERR | GLOB_NOESCAPE
| GLOB_ALTDIRFUNC))
| GLOB_NOSORT | GLOB_ONLYDIR),
errfunc, &dirs);
if (status != 0)
- return status;
+ {
+ if ((flags & GLOB_NOCHECK) == 0 || status != GLOB_NOMATCH)
+ return status;
+ goto no_matches;
+ }
/* We have successfully globbed the preceding directory name.
For each name we found, call glob_in_dir on it and FILENAME,
@@ -779,6 +926,7 @@ glob (pattern, flags, errfunc, pglob)
flag was set we must return the input pattern itself. */
if (pglob->gl_pathc + pglob->gl_offs == oldcount)
{
+ no_matches:
/* No matches. */
if (flags & GLOB_NOCHECK)
{
@@ -821,10 +969,44 @@ glob (pattern, flags, errfunc, pglob)
else
{
int old_pathc = pglob->gl_pathc;
+ int orig_flags = flags;
+ if (meta & 2)
+ {
+ char *p = strchr (dirname, '\\'), *q;
+ /* We need to unescape the dirname string. It is certainly
+ allocated by alloca, as otherwise filename would be NULL
+ or dirname wouldn't contain backslashes. */
+ q = p;
+ do
+ {
+ if (*p == '\\')
+ {
+ *q = *++p;
+ --dirlen;
+ }
+ else
+ *q = *p;
+ ++q;
+ }
+ while (*p++ != '\0');
+ dirname_modified = 1;
+ }
+ if (dirname_modified)
+ flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC);
status = glob_in_dir (filename, dirname, flags, errfunc, pglob);
if (status != 0)
- return status;
+ {
+ if (status == GLOB_NOMATCH && flags != orig_flags
+ && pglob->gl_pathc + pglob->gl_offs == oldcount)
+ {
+ /* Make sure globfree (&dirs); is a nop. */
+ dirs.gl_pathv = NULL;
+ flags = orig_flags;
+ goto no_matches;
+ }
+ return status;
+ }
if (dirlen > 0)
{
@@ -840,6 +1022,33 @@ glob (pattern, flags, errfunc, pglob)
}
}
+ if (flags & GLOB_MARK)
+ {
+ /* Append slashes to directory names. */
+ size_t i;
+ struct stat st;
+ struct_stat64 st64;
+
+ for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; ++i)
+ if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
+ ? ((*pglob->gl_stat) (pglob->gl_pathv[i], &st) == 0
+ && S_ISDIR (st.st_mode))
+ : (__stat64 (pglob->gl_pathv[i], &st64) == 0
+ && S_ISDIR (st64.st_mode))))
+ {
+ size_t len = strlen (pglob->gl_pathv[i]) + 2;
+ char *new = realloc (pglob->gl_pathv[i], len);
+ if (new == NULL)
+ {
+ globfree (pglob);
+ pglob->gl_pathc = 0;
+ return GLOB_NOSPACE;
+ }
+ strcpy (&new[len - 2], "/");
+ pglob->gl_pathv[i] = new;
+ }
+ }
+
if (!(flags & GLOB_NOSORT))
{
/* Sort the vector. */
@@ -955,15 +1164,13 @@ prefix_array (const char *dirname, char **array, size_t n)
/* We must not compile this function twice. */
#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
-/* Return nonzero if PATTERN contains any metacharacters.
- Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
int
-__glob_pattern_p (pattern, quote)
+__glob_pattern_type (pattern, quote)
const char *pattern;
int quote;
{
register const char *p;
- int open = 0;
+ int ret = 0;
for (p = pattern; *p != '\0'; ++p)
switch (*p)
@@ -973,21 +1180,35 @@ __glob_pattern_p (pattern, quote)
return 1;
case '\\':
- if (quote && p[1] != '\0')
- ++p;
+ if (quote)
+ {
+ if (p[1] != '\0')
+ ++p;
+ ret |= 2;
+ }
break;
case '[':
- open = 1;
+ ret |= 4;
break;
case ']':
- if (open)
+ if (ret & 4)
return 1;
break;
}
- return 0;
+ return ret;
+}
+
+/* Return nonzero if PATTERN contains any metacharacters.
+ Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
+int
+__glob_pattern_p (pattern, quote)
+ const char *pattern;
+ int quote;
+{
+ return __glob_pattern_type (pattern, quote) == 1;
}
# ifdef _LIBC
weak_alias (__glob_pattern_p, glob_pattern_p)
@@ -1000,21 +1221,33 @@ weak_alias (__glob_pattern_p, glob_pattern_p)
/* We put this in a separate function mainly to allow the memory
allocated with alloca to be recycled. */
#if !defined _LIBC || !defined GLOB_ONLY_P
-static bool
-is_dir_p (const char *dir, size_t dirlen, const char *fname,
- glob_t *pglob, int flags)
+static int
+__attribute_noinline__
+link_exists2_p (const char *dir, size_t dirlen, const char *fname,
+ glob_t *pglob)
{
size_t fnamelen = strlen (fname);
char *fullname = __alloca (dirlen + 1 + fnamelen + 1);
struct stat st;
- struct_stat64 st64;
mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1),
fname, fnamelen + 1);
- return ((flags & GLOB_ALTDIRFUNC)
- ? (*pglob->gl_stat) (fullname, &st) == 0 && S_ISDIR (st.st_mode)
- : __stat64 (fullname, &st64) == 0 && S_ISDIR (st64.st_mode));
+ return (*pglob->gl_stat) (fullname, &st) == 0;
+}
+
+/* Return true if DIR/FNAME exists. */
+static int
+link_exists_p (int dfd, const char *dir, size_t dirlen, const char *fname,
+ glob_t *pglob, int flags)
+{
+ if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
+ return link_exists2_p (dir, dirlen, fname, pglob);
+ else
+ {
+ struct_stat64 st64;
+ return __fxstatat64 (_STAT_VER, dfd, fname, &st64, 0) == 0;
+ }
}
#endif
@@ -1030,27 +1263,35 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
{
size_t dirlen = strlen (directory);
void *stream = NULL;
- struct globlink
+ struct globnames
{
- struct globlink *next;
- char *name;
+ struct globnames *next;
+ size_t count;
+ char *name[64];
};
- struct globlink *names = NULL;
- size_t nfound;
+#define INITIAL_COUNT sizeof (init_names.name) / sizeof (init_names.name[0])
+ struct globnames init_names;
+ struct globnames *names = &init_names;
+ struct globnames *names_alloca = &init_names;
+ size_t nfound = 0;
+ size_t allocasize = sizeof (init_names);
+ size_t cur = 0;
int meta;
int save;
+ int result;
- meta = __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE));
+ init_names.next = NULL;
+ init_names.count = INITIAL_COUNT;
+
+ meta = __glob_pattern_type (pattern, !(flags & GLOB_NOESCAPE));
if (meta == 0 && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
{
/* We need not do any tests. The PATTERN contains no meta
characters and we must not return an error therefore the
result will always contain exactly one name. */
flags |= GLOB_NOCHECK;
- nfound = 0;
}
- else if (meta == 0 &&
- ((flags & GLOB_NOESCAPE) || strchr (pattern, '\\') == NULL))
+ else if (meta == 0)
{
/* Since we use the normal file functions we can also use stat()
to verify the file is there. */
@@ -1062,134 +1303,115 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
"/", 1),
pattern, patlen + 1);
- if (((flags & GLOB_ALTDIRFUNC)
+ if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
? (*pglob->gl_stat) (fullname, &st)
: __stat64 (fullname, &st64)) == 0)
/* We found this file to be existing. Now tell the rest
of the function to copy this name into the result. */
flags |= GLOB_NOCHECK;
-
- nfound = 0;
}
else
{
- if (pattern[0] == '\0')
+ stream = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
+ ? (*pglob->gl_opendir) (directory)
+ : opendir (directory));
+ if (stream == NULL)
{
- /* This is a special case for matching directories like in
- "*a/". */
- names = __alloca (sizeof (struct globlink));
- names->name = malloc (1);
- if (names->name == NULL)
- goto memory_error;
- names->name[0] = '\0';
- names->next = NULL;
- nfound = 1;
- meta = 0;
+ if (errno != ENOTDIR
+ && ((errfunc != NULL && (*errfunc) (directory, errno))
+ || (flags & GLOB_ERR)))
+ return GLOB_ABORTED;
}
else
{
- stream = ((flags & GLOB_ALTDIRFUNC)
- ? (*pglob->gl_opendir) (directory)
- : opendir (directory));
- if (stream == NULL)
- {
- if (errno != ENOTDIR
- && ((errfunc != NULL && (*errfunc) (directory, errno))
- || (flags & GLOB_ERR)))
- return GLOB_ABORTED;
- nfound = 0;
- meta = 0;
- }
- else
- {
- int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
- | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
-#if defined _AMIGA || defined __VMS
- | FNM_CASEFOLD
+ int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
+ ? -1 : dirfd ((DIR *) stream));
+ int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
+ | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
+#if defined _AMIGA || defined VMS
+ | FNM_CASEFOLD
#endif
- );
- nfound = 0;
- flags |= GLOB_MAGCHAR;
+ );
+ flags |= GLOB_MAGCHAR;
- while (1)
- {
- const char *name;
- size_t len;
+ while (1)
+ {
+ const char *name;
+ size_t len;
#if defined _LIBC && !defined COMPILE_GLOB64
- struct dirent64 *d;
- union
- {
- struct dirent64 d64;
- char room [offsetof (struct dirent64, d_name[0])
- + NAME_MAX + 1];
- }
- d64buf;
+ struct dirent64 *d;
+ union
+ {
+ struct dirent64 d64;
+ char room [offsetof (struct dirent64, d_name[0])
+ + NAME_MAX + 1];
+ }
+ d64buf;
- if (flags & GLOB_ALTDIRFUNC)
+ if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
+ {
+ struct dirent *d32 = (*pglob->gl_readdir) (stream);
+ if (d32 != NULL)
{
- struct dirent *d32 = (*pglob->gl_readdir) (stream);
- if (d32 != NULL)
- {
- CONVERT_DIRENT_DIRENT64 (&d64buf.d64, d32);
- d = &d64buf.d64;
- }
- else
- d = NULL;
+ CONVERT_DIRENT_DIRENT64 (&d64buf.d64, d32);
+ d = &d64buf.d64;
}
else
- d = __readdir64 (stream);
+ d = NULL;
+ }
+ else
+ d = __readdir64 (stream);
#else
- struct dirent *d = ((flags & GLOB_ALTDIRFUNC)
- ? ((*pglob->gl_readdir) (stream))
- : __readdir (stream));
+ struct dirent *d = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
+ ? ((struct dirent *)
+ (*pglob->gl_readdir) (stream))
+ : __readdir (stream));
#endif
- if (d == NULL)
- break;
- if (! REAL_DIR_ENTRY (d))
- continue;
+ if (d == NULL)
+ break;
+ if (! REAL_DIR_ENTRY (d))
+ continue;
- /* If we shall match only directories use the information
- provided by the dirent call if possible. */
- if ((flags & GLOB_ONLYDIR) && !DIRENT_MIGHT_BE_DIR (d))
- continue;
+ /* If we shall match only directories use the information
+ provided by the dirent call if possible. */
+ if ((flags & GLOB_ONLYDIR) && !DIRENT_MIGHT_BE_DIR (d))
+ continue;
- name = d->d_name;
+ name = d->d_name;
- if (fnmatch (pattern, name, fnm_flags) == 0)
+ if (fnmatch (pattern, name, fnm_flags) == 0)
+ {
+ /* If the file we found is a symlink we have to
+ make sure the target file exists. */
+ if (!DIRENT_MIGHT_BE_SYMLINK (d)
+ || link_exists_p (dfd, directory, dirlen, name, pglob,
+ flags))
{
- /* ISDIR will often be incorrectly set to false
- when not in GLOB_ONLYDIR || GLOB_MARK mode, but we
- don't care. It won't be used and we save the
- expensive call to stat. */
- int need_dir_test =
- (GLOB_MARK | (DIRENT_MIGHT_BE_SYMLINK (d)
- ? GLOB_ONLYDIR : 0));
- bool isdir = (DIRENT_MUST_BE (d, DT_DIR)
- || ((flags & need_dir_test)
- && is_dir_p (directory, dirlen, name,
- pglob, flags)));
-
- /* In GLOB_ONLYDIR mode, skip non-dirs. */
- if ((flags & GLOB_ONLYDIR) && !isdir)
- continue;
-
+ if (cur == names->count)
{
- struct globlink *new =
- __alloca (sizeof (struct globlink));
- char *p;
- len = _D_EXACT_NAMLEN (d);
- new->name =
- malloc (len + 1 + ((flags & GLOB_MARK) && isdir));
- if (new->name == NULL)
+ struct globnames *newnames;
+ size_t count = names->count * 2;
+ size_t size = (sizeof (struct globnames)
+ + ((count - INITIAL_COUNT)
+ * sizeof (char *)));
+ allocasize += size;
+ if (__libc_use_alloca (allocasize))
+ newnames = names_alloca = __alloca (size);
+ else if ((newnames = malloc (size))
+ == NULL)
goto memory_error;
- p = mempcpy (new->name, name, len);
- if ((flags & GLOB_MARK) && isdir)
- *p++ = '/';
- *p = '\0';
- new->next = names;
- names = new;
- ++nfound;
+ newnames->count = count;
+ newnames->next = names;
+ names = newnames;
+ cur = 0;
}
+ len = _D_EXACT_NAMLEN (d);
+ names->name[cur] = malloc (len + 1);
+ if (names->name[cur] == NULL)
+ goto memory_error;
+ *((char *) mempcpy (names->name[cur++], name, len))
+ = '\0';
+ ++nfound;
}
}
}
@@ -1200,59 +1422,89 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
{
size_t len = strlen (pattern);
nfound = 1;
- names = __alloca (sizeof (struct globlink));
- names->next = NULL;
- names->name = malloc (len + 1);
- if (names->name == NULL)
+ names->name[cur] = malloc (len + 1);
+ if (names->name[cur] == NULL)
goto memory_error;
- *((char *) mempcpy (names->name, pattern, len)) = '\0';
+ *((char *) mempcpy (names->name[cur++], pattern, len)) = '\0';
}
+ result = GLOB_NOMATCH;
if (nfound != 0)
{
- char **new_gl_pathv;
-
- new_gl_pathv
+ char **new_gl_pathv
= realloc (pglob->gl_pathv,
(pglob->gl_pathc + pglob->gl_offs + nfound + 1)
* sizeof (char *));
+ result = 0;
+
if (new_gl_pathv == NULL)
- goto memory_error;
- pglob->gl_pathv = new_gl_pathv;
+ {
+ memory_error:
+ while (1)
+ {
+ struct globnames *old = names;
+ for (size_t i = 0; i < cur; ++i)
+ free (names->name[i]);
+ names = names->next;
+ /* NB: we will not leak memory here if we exit without
+ freeing the current block assigned to OLD. At least
+ the very first block is always allocated on the stack
+ and this is the block assigned to OLD here. */
+ if (names == NULL)
+ {
+ assert (old == &init_names);
+ break;
+ }
+ cur = names->count;
+ if (old == names_alloca)
+ names_alloca = names;
+ else
+ free (old);
+ }
+ result = GLOB_NOSPACE;
+ }
+ else
+ {
+ while (1)
+ {
+ struct globnames *old = names;
+ for (size_t i = 0; i < cur; ++i)
+ new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++]
+ = names->name[i];
+ names = names->next;
+ /* NB: we will not leak memory here if we exit without
+ freeing the current block assigned to OLD. At least
+ the very first block is always allocated on the stack
+ and this is the block assigned to OLD here. */
+ if (names == NULL)
+ {
+ assert (old == &init_names);
+ break;
+ }
+ cur = names->count;
+ if (old == names_alloca)
+ names_alloca = names;
+ else
+ free (old);
+ }
+
+ pglob->gl_pathv = new_gl_pathv;
- for (; names != NULL; names = names->next)
- pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = names->name;
- pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
+ pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
- pglob->gl_flags = flags;
+ pglob->gl_flags = flags;
+ }
}
- save = errno;
if (stream != NULL)
{
- if (flags & GLOB_ALTDIRFUNC)
+ save = errno;
+ if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
(*pglob->gl_closedir) (stream);
else
closedir (stream);
+ __set_errno (save);
}
- __set_errno (save);
- return nfound == 0 ? GLOB_NOMATCH : 0;
-
- memory_error:
- {
- int save = errno;
- if (flags & GLOB_ALTDIRFUNC)
- (*pglob->gl_closedir) (stream);
- else
- closedir (stream);
- __set_errno (save);
- }
- while (names != NULL)
- {
- if (names->name != NULL)
- free (names->name);
- names = names->next;
- }
- return GLOB_NOSPACE;
+ return result;
}
diff --git a/gnulib/lib/glob_.h b/gnulib/lib/glob.in.h
index 451b111e..997833b7 100644
--- a/gnulib/lib/glob_.h
+++ b/gnulib/lib/glob.in.h
@@ -1,4 +1,4 @@
-/* glob_.h -- Find a path matching a pattern.
+/* glob.h -- Find a path matching a pattern.
Copyright (C) 2005-2007 Free Software Foundation, Inc.
@@ -6,7 +6,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/hash-pjw.c b/gnulib/lib/hash-pjw.c
new file mode 100644
index 00000000..42164f61
--- /dev/null
+++ b/gnulib/lib/hash-pjw.c
@@ -0,0 +1,40 @@
+/* hash-pjw.c -- compute a hash value from a NUL-terminated string.
+
+ Copyright (C) 2001, 2003, 2006 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 <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include "hash-pjw.h"
+
+#include <limits.h>
+
+#define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
+
+/* A hash function for NUL-terminated char* strings using
+ the method described by Bruno Haible.
+ See http://www.haible.de/bruno/hashfunc.html. */
+
+size_t
+hash_pjw (const void *x, size_t tablesize)
+{
+ const char *s;
+ size_t h = 0;
+
+ for (s = x; *s; s++)
+ h = *s + ((h << 9) | (h >> (SIZE_BITS - 9)));
+
+ return h % tablesize;
+}
diff --git a/gnulib/lib/hash-pjw.h b/gnulib/lib/hash-pjw.h
new file mode 100644
index 00000000..1fddb202
--- /dev/null
+++ b/gnulib/lib/hash-pjw.h
@@ -0,0 +1,23 @@
+/* hash-pjw.h -- declaration for a simple hash function
+ Copyright (C) 2001, 2003 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 <http://www.gnu.org/licenses/>. */
+
+#include <stddef.h>
+
+/* Compute a hash code for a NUL-terminated string starting at X,
+ and return the hash code modulo TABLESIZE.
+ The result is platform dependent: it depends on the size of the 'size_t'
+ type and on the signedness of the 'char' type. */
+extern size_t hash_pjw (void const *x, size_t tablesize);
diff --git a/gnulib/lib/hash-triple.c b/gnulib/lib/hash-triple.c
new file mode 100644
index 00000000..ef8e1384
--- /dev/null
+++ b/gnulib/lib/hash-triple.c
@@ -0,0 +1,77 @@
+/* Hash functions for file-related triples: name, device, inode.
+ Copyright (C) 2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "hash-triple.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "hash-pjw.h"
+#include "same.h"
+#include "same-inode.h"
+
+#define STREQ(a, b) (strcmp ((a), (b)) == 0)
+
+/* Hash an F_triple, and *do* consider the file name. */
+size_t
+triple_hash (void const *x, size_t table_size)
+{
+ struct F_triple const *p = x;
+ size_t tmp = hash_pjw (p->name, table_size);
+
+ /* Ignoring the device number here should be fine. */
+ return (tmp ^ p->st_ino) % table_size;
+}
+
+/* Hash an F_triple, without considering the file name. */
+size_t
+triple_hash_no_name (void const *x, size_t table_size)
+{
+ struct F_triple const *p = x;
+
+ /* Ignoring the device number here should be fine. */
+ return p->st_ino % table_size;
+}
+
+/* Compare two F_triple structs. */
+bool
+triple_compare (void const *x, void const *y)
+{
+ struct F_triple const *a = x;
+ struct F_triple const *b = y;
+ return (SAME_INODE (*a, *b) && same_name (a->name, b->name)) ? true : false;
+}
+
+bool
+triple_compare_ino_str (void const *x, void const *y)
+{
+ struct F_triple const *a = x;
+ struct F_triple const *b = y;
+ return (SAME_INODE (*a, *b) && STREQ (a->name, b->name)) ? true : false;
+}
+
+/* Free an F_triple. */
+void
+triple_free (void *x)
+{
+ struct F_triple *a = x;
+ free (a->name);
+ free (a);
+}
diff --git a/gnulib/lib/hash-triple.h b/gnulib/lib/hash-triple.h
new file mode 100644
index 00000000..51863c9d
--- /dev/null
+++ b/gnulib/lib/hash-triple.h
@@ -0,0 +1,22 @@
+#ifndef HASH_TRIPLE_H
+#define HASH_TRIPLE_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdbool.h>
+
+/* Describe a just-created or just-renamed destination file. */
+struct F_triple
+{
+ char *name;
+ ino_t st_ino;
+ dev_t st_dev;
+};
+
+extern size_t triple_hash (void const *x, size_t table_size);
+extern size_t triple_hash_no_name (void const *x, size_t table_size);
+extern bool triple_compare (void const *x, void const *y);
+extern bool triple_compare_ino_str (void const *x, void const *y);
+extern void triple_free (void *x);
+
+#endif
diff --git a/gnulib/lib/hash.c b/gnulib/lib/hash.c
new file mode 100644
index 00000000..7d76d45f
--- /dev/null
+++ b/gnulib/lib/hash.c
@@ -0,0 +1,1049 @@
+/* hash - hashing table processing.
+
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free
+ Software Foundation, Inc.
+
+ Written by Jim Meyering, 1992.
+
+ 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 <http://www.gnu.org/licenses/>. */
+
+/* A generic hash table package. */
+
+/* Define USE_OBSTACK to 1 if you want the allocator to use obstacks instead
+ of malloc. If you change USE_OBSTACK, you have to recompile! */
+
+#include <config.h>
+
+#include "hash.h"
+#include "xalloc.h"
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#if USE_OBSTACK
+# include "obstack.h"
+# ifndef obstack_chunk_alloc
+# define obstack_chunk_alloc malloc
+# endif
+# ifndef obstack_chunk_free
+# define obstack_chunk_free free
+# endif
+#endif
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
+struct hash_table
+ {
+ /* The array of buckets starts at BUCKET and extends to BUCKET_LIMIT-1,
+ for a possibility of N_BUCKETS. Among those, N_BUCKETS_USED buckets
+ are not empty, there are N_ENTRIES active entries in the table. */
+ struct hash_entry *bucket;
+ struct hash_entry const *bucket_limit;
+ size_t n_buckets;
+ size_t n_buckets_used;
+ size_t n_entries;
+
+ /* Tuning arguments, kept in a physicaly separate structure. */
+ const Hash_tuning *tuning;
+
+ /* Three functions are given to `hash_initialize', see the documentation
+ block for this function. In a word, HASHER randomizes a user entry
+ into a number up from 0 up to some maximum minus 1; COMPARATOR returns
+ true if two user entries compare equally; and DATA_FREER is the cleanup
+ function for a user entry. */
+ Hash_hasher hasher;
+ Hash_comparator comparator;
+ Hash_data_freer data_freer;
+
+ /* A linked list of freed struct hash_entry structs. */
+ struct hash_entry *free_entry_list;
+
+#if USE_OBSTACK
+ /* Whenever obstacks are used, it is possible to allocate all overflowed
+ entries into a single stack, so they all can be freed in a single
+ operation. It is not clear if the speedup is worth the trouble. */
+ struct obstack entry_stack;
+#endif
+ };
+
+/* A hash table contains many internal entries, each holding a pointer to
+ some user provided data (also called a user entry). An entry indistinctly
+ refers to both the internal entry and its associated user entry. A user
+ entry contents may be hashed by a randomization function (the hashing
+ function, or just `hasher' for short) into a number (or `slot') between 0
+ and the current table size. At each slot position in the hash table,
+ starts a linked chain of entries for which the user data all hash to this
+ slot. A bucket is the collection of all entries hashing to the same slot.
+
+ A good `hasher' function will distribute entries rather evenly in buckets.
+ In the ideal case, the length of each bucket is roughly the number of
+ entries divided by the table size. Finding the slot for a data is usually
+ done in constant time by the `hasher', and the later finding of a precise
+ entry is linear in time with the size of the bucket. Consequently, a
+ larger hash table size (that is, a larger number of buckets) is prone to
+ yielding shorter chains, *given* the `hasher' function behaves properly.
+
+ Long buckets slow down the lookup algorithm. One might use big hash table
+ sizes in hope to reduce the average length of buckets, but this might
+ become inordinate, as unused slots in the hash table take some space. The
+ best bet is to make sure you are using a good `hasher' function (beware
+ that those are not that easy to write! :-), and to use a table size
+ larger than the actual number of entries. */
+
+/* If an insertion makes the ratio of nonempty buckets to table size larger
+ than the growth threshold (a number between 0.0 and 1.0), then increase
+ the table size by multiplying by the growth factor (a number greater than
+ 1.0). The growth threshold defaults to 0.8, and the growth factor
+ defaults to 1.414, meaning that the table will have doubled its size
+ every second time 80% of the buckets get used. */
+#define DEFAULT_GROWTH_THRESHOLD 0.8
+#define DEFAULT_GROWTH_FACTOR 1.414
+
+/* If a deletion empties a bucket and causes the ratio of used buckets to
+ table size to become smaller than the shrink threshold (a number between
+ 0.0 and 1.0), then shrink the table by multiplying by the shrink factor (a
+ number greater than the shrink threshold but smaller than 1.0). The shrink
+ threshold and factor default to 0.0 and 1.0, meaning that the table never
+ shrinks. */
+#define DEFAULT_SHRINK_THRESHOLD 0.0
+#define DEFAULT_SHRINK_FACTOR 1.0
+
+/* Use this to initialize or reset a TUNING structure to
+ some sensible values. */
+static const Hash_tuning default_tuning =
+ {
+ DEFAULT_SHRINK_THRESHOLD,
+ DEFAULT_SHRINK_FACTOR,
+ DEFAULT_GROWTH_THRESHOLD,
+ DEFAULT_GROWTH_FACTOR,
+ false
+ };
+
+/* Information and lookup. */
+
+/* The following few functions provide information about the overall hash
+ table organization: the number of entries, number of buckets and maximum
+ length of buckets. */
+
+/* Return the number of buckets in the hash table. The table size, the total
+ number of buckets (used plus unused), or the maximum number of slots, are
+ the same quantity. */
+
+size_t
+hash_get_n_buckets (const Hash_table *table)
+{
+ return table->n_buckets;
+}
+
+/* Return the number of slots in use (non-empty buckets). */
+
+size_t
+hash_get_n_buckets_used (const Hash_table *table)
+{
+ return table->n_buckets_used;
+}
+
+/* Return the number of active entries. */
+
+size_t
+hash_get_n_entries (const Hash_table *table)
+{
+ return table->n_entries;
+}
+
+/* Return the length of the longest chain (bucket). */
+
+size_t
+hash_get_max_bucket_length (const Hash_table *table)
+{
+ struct hash_entry const *bucket;
+ size_t max_bucket_length = 0;
+
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ if (bucket->data)
+ {
+ struct hash_entry const *cursor = bucket;
+ size_t bucket_length = 1;
+
+ while (cursor = cursor->next, cursor)
+ bucket_length++;
+
+ if (bucket_length > max_bucket_length)
+ max_bucket_length = bucket_length;
+ }
+ }
+
+ return max_bucket_length;
+}
+
+/* Do a mild validation of a hash table, by traversing it and checking two
+ statistics. */
+
+bool
+hash_table_ok (const Hash_table *table)
+{
+ struct hash_entry const *bucket;
+ size_t n_buckets_used = 0;
+ size_t n_entries = 0;
+
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ if (bucket->data)
+ {
+ struct hash_entry const *cursor = bucket;
+
+ /* Count bucket head. */
+ n_buckets_used++;
+ n_entries++;
+
+ /* Count bucket overflow. */
+ while (cursor = cursor->next, cursor)
+ n_entries++;
+ }
+ }
+
+ if (n_buckets_used == table->n_buckets_used && n_entries == table->n_entries)
+ return true;
+
+ return false;
+}
+
+void
+hash_print_statistics (const Hash_table *table, FILE *stream)
+{
+ size_t n_entries = hash_get_n_entries (table);
+ size_t n_buckets = hash_get_n_buckets (table);
+ size_t n_buckets_used = hash_get_n_buckets_used (table);
+ size_t max_bucket_length = hash_get_max_bucket_length (table);
+
+ fprintf (stream, "# entries: %lu\n", (unsigned long int) n_entries);
+ fprintf (stream, "# buckets: %lu\n", (unsigned long int) n_buckets);
+ fprintf (stream, "# buckets used: %lu (%.2f%%)\n",
+ (unsigned long int) n_buckets_used,
+ (100.0 * n_buckets_used) / n_buckets);
+ fprintf (stream, "max bucket length: %lu\n",
+ (unsigned long int) max_bucket_length);
+}
+
+/* If ENTRY matches an entry already in the hash table, return the
+ entry from the table. Otherwise, return NULL. */
+
+void *
+hash_lookup (const Hash_table *table, const void *entry)
+{
+ struct hash_entry const *bucket
+ = table->bucket + table->hasher (entry, table->n_buckets);
+ struct hash_entry const *cursor;
+
+ if (! (bucket < table->bucket_limit))
+ abort ();
+
+ if (bucket->data == NULL)
+ return NULL;
+
+ for (cursor = bucket; cursor; cursor = cursor->next)
+ if (table->comparator (entry, cursor->data))
+ return cursor->data;
+
+ return NULL;
+}
+
+/* Walking. */
+
+/* The functions in this page traverse the hash table and process the
+ contained entries. For the traversal to work properly, the hash table
+ should not be resized nor modified while any particular entry is being
+ processed. In particular, entries should not be added or removed. */
+
+/* Return the first data in the table, or NULL if the table is empty. */
+
+void *
+hash_get_first (const Hash_table *table)
+{
+ struct hash_entry const *bucket;
+
+ if (table->n_entries == 0)
+ return NULL;
+
+ for (bucket = table->bucket; ; bucket++)
+ if (! (bucket < table->bucket_limit))
+ abort ();
+ else if (bucket->data)
+ return bucket->data;
+}
+
+/* Return the user data for the entry following ENTRY, where ENTRY has been
+ returned by a previous call to either `hash_get_first' or `hash_get_next'.
+ Return NULL if there are no more entries. */
+
+void *
+hash_get_next (const Hash_table *table, const void *entry)
+{
+ struct hash_entry const *bucket
+ = table->bucket + table->hasher (entry, table->n_buckets);
+ struct hash_entry const *cursor;
+
+ if (! (bucket < table->bucket_limit))
+ abort ();
+
+ /* Find next entry in the same bucket. */
+ for (cursor = bucket; cursor; cursor = cursor->next)
+ if (cursor->data == entry && cursor->next)
+ return cursor->next->data;
+
+ /* Find first entry in any subsequent bucket. */
+ while (++bucket < table->bucket_limit)
+ if (bucket->data)
+ return bucket->data;
+
+ /* None found. */
+ return NULL;
+}
+
+/* Fill BUFFER with pointers to active user entries in the hash table, then
+ return the number of pointers copied. Do not copy more than BUFFER_SIZE
+ pointers. */
+
+size_t
+hash_get_entries (const Hash_table *table, void **buffer,
+ size_t buffer_size)
+{
+ size_t counter = 0;
+ struct hash_entry const *bucket;
+ struct hash_entry const *cursor;
+
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ if (bucket->data)
+ {
+ for (cursor = bucket; cursor; cursor = cursor->next)
+ {
+ if (counter >= buffer_size)
+ return counter;
+ buffer[counter++] = cursor->data;
+ }
+ }
+ }
+
+ return counter;
+}
+
+/* Call a PROCESSOR function for each entry of a hash table, and return the
+ number of entries for which the processor function returned success. A
+ pointer to some PROCESSOR_DATA which will be made available to each call to
+ the processor function. The PROCESSOR accepts two arguments: the first is
+ the user entry being walked into, the second is the value of PROCESSOR_DATA
+ as received. The walking continue for as long as the PROCESSOR function
+ returns nonzero. When it returns zero, the walking is interrupted. */
+
+size_t
+hash_do_for_each (const Hash_table *table, Hash_processor processor,
+ void *processor_data)
+{
+ size_t counter = 0;
+ struct hash_entry const *bucket;
+ struct hash_entry const *cursor;
+
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ if (bucket->data)
+ {
+ for (cursor = bucket; cursor; cursor = cursor->next)
+ {
+ if (!(*processor) (cursor->data, processor_data))
+ return counter;
+ counter++;
+ }
+ }
+ }
+
+ return counter;
+}
+
+/* Allocation and clean-up. */
+
+/* Return a hash index for a NUL-terminated STRING between 0 and N_BUCKETS-1.
+ This is a convenience routine for constructing other hashing functions. */
+
+#if USE_DIFF_HASH
+
+/* About hashings, Paul Eggert writes to me (FP), on 1994-01-01: "Please see
+ B. J. McKenzie, R. Harries & T. Bell, Selecting a hashing algorithm,
+ Software--practice & experience 20, 2 (Feb 1990), 209-224. Good hash
+ algorithms tend to be domain-specific, so what's good for [diffutils'] io.c
+ may not be good for your application." */
+
+size_t
+hash_string (const char *string, size_t n_buckets)
+{
+# define ROTATE_LEFT(Value, Shift) \
+ ((Value) << (Shift) | (Value) >> ((sizeof (size_t) * CHAR_BIT) - (Shift)))
+# define HASH_ONE_CHAR(Value, Byte) \
+ ((Byte) + ROTATE_LEFT (Value, 7))
+
+ size_t value = 0;
+ unsigned char ch;
+
+ for (; (ch = *string); string++)
+ value = HASH_ONE_CHAR (value, ch);
+ return value % n_buckets;
+
+# undef ROTATE_LEFT
+# undef HASH_ONE_CHAR
+}
+
+#else /* not USE_DIFF_HASH */
+
+/* This one comes from `recode', and performs a bit better than the above as
+ per a few experiments. It is inspired from a hashing routine found in the
+ very old Cyber `snoop', itself written in typical Greg Mansfield style.
+ (By the way, what happened to this excellent man? Is he still alive?) */
+
+size_t
+hash_string (const char *string, size_t n_buckets)
+{
+ size_t value = 0;
+ unsigned char ch;
+
+ for (; (ch = *string); string++)
+ value = (value * 31 + ch) % n_buckets;
+ return value;
+}
+
+#endif /* not USE_DIFF_HASH */
+
+/* Return true if CANDIDATE is a prime number. CANDIDATE should be an odd
+ number at least equal to 11. */
+
+static bool
+is_prime (size_t candidate)
+{
+ size_t divisor = 3;
+ size_t square = divisor * divisor;
+
+ while (square < candidate && (candidate % divisor))
+ {
+ divisor++;
+ square += 4 * divisor;
+ divisor++;
+ }
+
+ return (candidate % divisor ? true : false);
+}
+
+/* Round a given CANDIDATE number up to the nearest prime, and return that
+ prime. Primes lower than 10 are merely skipped. */
+
+static size_t
+next_prime (size_t candidate)
+{
+ /* Skip small primes. */
+ if (candidate < 10)
+ candidate = 10;
+
+ /* Make it definitely odd. */
+ candidate |= 1;
+
+ while (!is_prime (candidate))
+ candidate += 2;
+
+ return candidate;
+}
+
+void
+hash_reset_tuning (Hash_tuning *tuning)
+{
+ *tuning = default_tuning;
+}
+
+/* For the given hash TABLE, check the user supplied tuning structure for
+ reasonable values, and return true if there is no gross error with it.
+ Otherwise, definitively reset the TUNING field to some acceptable default
+ in the hash table (that is, the user loses the right of further modifying
+ tuning arguments), and return false. */
+
+static bool
+check_tuning (Hash_table *table)
+{
+ const Hash_tuning *tuning = table->tuning;
+
+ /* Be a bit stricter than mathematics would require, so that
+ rounding errors in size calculations do not cause allocations to
+ fail to grow or shrink as they should. The smallest allocation
+ is 11 (due to next_prime's algorithm), so an epsilon of 0.1
+ should be good enough. */
+ float epsilon = 0.1f;
+
+ if (epsilon < tuning->growth_threshold
+ && tuning->growth_threshold < 1 - epsilon
+ && 1 + epsilon < tuning->growth_factor
+ && 0 <= tuning->shrink_threshold
+ && tuning->shrink_threshold + epsilon < tuning->shrink_factor
+ && tuning->shrink_factor <= 1
+ && tuning->shrink_threshold + epsilon < tuning->growth_threshold)
+ return true;
+
+ table->tuning = &default_tuning;
+ return false;
+}
+
+/* Allocate and return a new hash table, or NULL upon failure. The initial
+ number of buckets is automatically selected so as to _guarantee_ that you
+ may insert at least CANDIDATE different user entries before any growth of
+ the hash table size occurs. So, if have a reasonably tight a-priori upper
+ bound on the number of entries you intend to insert in the hash table, you
+ may save some table memory and insertion time, by specifying it here. If
+ the IS_N_BUCKETS field of the TUNING structure is true, the CANDIDATE
+ argument has its meaning changed to the wanted number of buckets.
+
+ TUNING points to a structure of user-supplied values, in case some fine
+ tuning is wanted over the default behavior of the hasher. If TUNING is
+ NULL, the default tuning parameters are used instead.
+
+ The user-supplied HASHER function should be provided. It accepts two
+ arguments ENTRY and TABLE_SIZE. It computes, by hashing ENTRY contents, a
+ slot number for that entry which should be in the range 0..TABLE_SIZE-1.
+ This slot number is then returned.
+
+ The user-supplied COMPARATOR function should be provided. It accepts two
+ arguments pointing to user data, it then returns true for a pair of entries
+ that compare equal, or false otherwise. This function is internally called
+ on entries which are already known to hash to the same bucket index.
+
+ The user-supplied DATA_FREER function, when not NULL, may be later called
+ with the user data as an argument, just before the entry containing the
+ data gets freed. This happens from within `hash_free' or `hash_clear'.
+ You should specify this function only if you want these functions to free
+ all of your `data' data. This is typically the case when your data is
+ simply an auxiliary struct that you have malloc'd to aggregate several
+ values. */
+
+Hash_table *
+hash_initialize (size_t candidate, const Hash_tuning *tuning,
+ Hash_hasher hasher, Hash_comparator comparator,
+ Hash_data_freer data_freer)
+{
+ Hash_table *table;
+
+ if (hasher == NULL || comparator == NULL)
+ return NULL;
+
+ table = malloc (sizeof *table);
+ if (table == NULL)
+ return NULL;
+
+ if (!tuning)
+ tuning = &default_tuning;
+ table->tuning = tuning;
+ if (!check_tuning (table))
+ {
+ /* Fail if the tuning options are invalid. This is the only occasion
+ when the user gets some feedback about it. Once the table is created,
+ if the user provides invalid tuning options, we silently revert to
+ using the defaults, and ignore further request to change the tuning
+ options. */
+ goto fail;
+ }
+
+ if (!tuning->is_n_buckets)
+ {
+ float new_candidate = candidate / tuning->growth_threshold;
+ if (SIZE_MAX <= new_candidate)
+ goto fail;
+ candidate = new_candidate;
+ }
+
+ if (xalloc_oversized (candidate, sizeof *table->bucket))
+ goto fail;
+ table->n_buckets = next_prime (candidate);
+ if (xalloc_oversized (table->n_buckets, sizeof *table->bucket))
+ goto fail;
+
+ table->bucket = calloc (table->n_buckets, sizeof *table->bucket);
+ if (table->bucket == NULL)
+ goto fail;
+ table->bucket_limit = table->bucket + table->n_buckets;
+ table->n_buckets_used = 0;
+ table->n_entries = 0;
+
+ table->hasher = hasher;
+ table->comparator = comparator;
+ table->data_freer = data_freer;
+
+ table->free_entry_list = NULL;
+#if USE_OBSTACK
+ obstack_init (&table->entry_stack);
+#endif
+ return table;
+
+ fail:
+ free (table);
+ return NULL;
+}
+
+/* Make all buckets empty, placing any chained entries on the free list.
+ Apply the user-specified function data_freer (if any) to the datas of any
+ affected entries. */
+
+void
+hash_clear (Hash_table *table)
+{
+ struct hash_entry *bucket;
+
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ if (bucket->data)
+ {
+ struct hash_entry *cursor;
+ struct hash_entry *next;
+
+ /* Free the bucket overflow. */
+ for (cursor = bucket->next; cursor; cursor = next)
+ {
+ if (table->data_freer)
+ (*table->data_freer) (cursor->data);
+ cursor->data = NULL;
+
+ next = cursor->next;
+ /* Relinking is done one entry at a time, as it is to be expected
+ that overflows are either rare or short. */
+ cursor->next = table->free_entry_list;
+ table->free_entry_list = cursor;
+ }
+
+ /* Free the bucket head. */
+ if (table->data_freer)
+ (*table->data_freer) (bucket->data);
+ bucket->data = NULL;
+ bucket->next = NULL;
+ }
+ }
+
+ table->n_buckets_used = 0;
+ table->n_entries = 0;
+}
+
+/* Reclaim all storage associated with a hash table. If a data_freer
+ function has been supplied by the user when the hash table was created,
+ this function applies it to the data of each entry before freeing that
+ entry. */
+
+void
+hash_free (Hash_table *table)
+{
+ struct hash_entry *bucket;
+ struct hash_entry *cursor;
+ struct hash_entry *next;
+
+ /* Call the user data_freer function. */
+ if (table->data_freer && table->n_entries)
+ {
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ if (bucket->data)
+ {
+ for (cursor = bucket; cursor; cursor = cursor->next)
+ {
+ (*table->data_freer) (cursor->data);
+ }
+ }
+ }
+ }
+
+#if USE_OBSTACK
+
+ obstack_free (&table->entry_stack, NULL);
+
+#else
+
+ /* Free all bucket overflowed entries. */
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ for (cursor = bucket->next; cursor; cursor = next)
+ {
+ next = cursor->next;
+ free (cursor);
+ }
+ }
+
+ /* Also reclaim the internal list of previously freed entries. */
+ for (cursor = table->free_entry_list; cursor; cursor = next)
+ {
+ next = cursor->next;
+ free (cursor);
+ }
+
+#endif
+
+ /* Free the remainder of the hash table structure. */
+ free (table->bucket);
+ free (table);
+}
+
+/* Insertion and deletion. */
+
+/* Get a new hash entry for a bucket overflow, possibly by reclying a
+ previously freed one. If this is not possible, allocate a new one. */
+
+static struct hash_entry *
+allocate_entry (Hash_table *table)
+{
+ struct hash_entry *new;
+
+ if (table->free_entry_list)
+ {
+ new = table->free_entry_list;
+ table->free_entry_list = new->next;
+ }
+ else
+ {
+#if USE_OBSTACK
+ new = obstack_alloc (&table->entry_stack, sizeof *new);
+#else
+ new = malloc (sizeof *new);
+#endif
+ }
+
+ return new;
+}
+
+/* Free a hash entry which was part of some bucket overflow,
+ saving it for later recycling. */
+
+static void
+free_entry (Hash_table *table, struct hash_entry *entry)
+{
+ entry->data = NULL;
+ entry->next = table->free_entry_list;
+ table->free_entry_list = entry;
+}
+
+/* This private function is used to help with insertion and deletion. When
+ ENTRY matches an entry in the table, return a pointer to the corresponding
+ user data and set *BUCKET_HEAD to the head of the selected bucket.
+ Otherwise, return NULL. When DELETE is true and ENTRY matches an entry in
+ the table, unlink the matching entry. */
+
+static void *
+hash_find_entry (Hash_table *table, const void *entry,
+ struct hash_entry **bucket_head, bool delete)
+{
+ struct hash_entry *bucket
+ = table->bucket + table->hasher (entry, table->n_buckets);
+ struct hash_entry *cursor;
+
+ if (! (bucket < table->bucket_limit))
+ abort ();
+
+ *bucket_head = bucket;
+
+ /* Test for empty bucket. */
+ if (bucket->data == NULL)
+ return NULL;
+
+ /* See if the entry is the first in the bucket. */
+ if ((*table->comparator) (entry, bucket->data))
+ {
+ void *data = bucket->data;
+
+ if (delete)
+ {
+ if (bucket->next)
+ {
+ struct hash_entry *next = bucket->next;
+
+ /* Bump the first overflow entry into the bucket head, then save
+ the previous first overflow entry for later recycling. */
+ *bucket = *next;
+ free_entry (table, next);
+ }
+ else
+ {
+ bucket->data = NULL;
+ }
+ }
+
+ return data;
+ }
+
+ /* Scan the bucket overflow. */
+ for (cursor = bucket; cursor->next; cursor = cursor->next)
+ {
+ if ((*table->comparator) (entry, cursor->next->data))
+ {
+ void *data = cursor->next->data;
+
+ if (delete)
+ {
+ struct hash_entry *next = cursor->next;
+
+ /* Unlink the entry to delete, then save the freed entry for later
+ recycling. */
+ cursor->next = next->next;
+ free_entry (table, next);
+ }
+
+ return data;
+ }
+ }
+
+ /* No entry found. */
+ return NULL;
+}
+
+/* For an already existing hash table, change the number of buckets through
+ specifying CANDIDATE. The contents of the hash table are preserved. The
+ new number of buckets is automatically selected so as to _guarantee_ that
+ the table may receive at least CANDIDATE different user entries, including
+ those already in the table, before any other growth of the hash table size
+ occurs. If TUNING->IS_N_BUCKETS is true, then CANDIDATE specifies the
+ exact number of buckets desired. */
+
+bool
+hash_rehash (Hash_table *table, size_t candidate)
+{
+ Hash_table *new_table;
+ struct hash_entry *bucket;
+ struct hash_entry *cursor;
+ struct hash_entry *next;
+
+ new_table = hash_initialize (candidate, table->tuning, table->hasher,
+ table->comparator, table->data_freer);
+ if (new_table == NULL)
+ return false;
+
+ /* Merely reuse the extra old space into the new table. */
+#if USE_OBSTACK
+ obstack_free (&new_table->entry_stack, NULL);
+ new_table->entry_stack = table->entry_stack;
+#endif
+ new_table->free_entry_list = table->free_entry_list;
+
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ if (bucket->data)
+ for (cursor = bucket; cursor; cursor = next)
+ {
+ void *data = cursor->data;
+ struct hash_entry *new_bucket
+ = (new_table->bucket
+ + new_table->hasher (data, new_table->n_buckets));
+
+ if (! (new_bucket < new_table->bucket_limit))
+ abort ();
+
+ next = cursor->next;
+
+ if (new_bucket->data)
+ {
+ if (cursor == bucket)
+ {
+ /* Allocate or recycle an entry, when moving from a bucket
+ header into a bucket overflow. */
+ struct hash_entry *new_entry = allocate_entry (new_table);
+
+ if (new_entry == NULL)
+ return false;
+
+ new_entry->data = data;
+ new_entry->next = new_bucket->next;
+ new_bucket->next = new_entry;
+ }
+ else
+ {
+ /* Merely relink an existing entry, when moving from a
+ bucket overflow into a bucket overflow. */
+ cursor->next = new_bucket->next;
+ new_bucket->next = cursor;
+ }
+ }
+ else
+ {
+ /* Free an existing entry, when moving from a bucket
+ overflow into a bucket header. Also take care of the
+ simple case of moving from a bucket header into a bucket
+ header. */
+ new_bucket->data = data;
+ new_table->n_buckets_used++;
+ if (cursor != bucket)
+ free_entry (new_table, cursor);
+ }
+ }
+
+ free (table->bucket);
+ table->bucket = new_table->bucket;
+ table->bucket_limit = new_table->bucket_limit;
+ table->n_buckets = new_table->n_buckets;
+ table->n_buckets_used = new_table->n_buckets_used;
+ table->free_entry_list = new_table->free_entry_list;
+ /* table->n_entries already holds its value. */
+#if USE_OBSTACK
+ table->entry_stack = new_table->entry_stack;
+#endif
+ free (new_table);
+
+ return true;
+}
+
+/* If ENTRY matches an entry already in the hash table, return the pointer
+ to the entry from the table. Otherwise, insert ENTRY and return ENTRY.
+ Return NULL if the storage required for insertion cannot be allocated. */
+
+void *
+hash_insert (Hash_table *table, const void *entry)
+{
+ void *data;
+ struct hash_entry *bucket;
+
+ /* The caller cannot insert a NULL entry. */
+ if (! entry)
+ abort ();
+
+ /* If there's a matching entry already in the table, return that. */
+ if ((data = hash_find_entry (table, entry, &bucket, false)) != NULL)
+ return data;
+
+ /* ENTRY is not matched, it should be inserted. */
+
+ if (bucket->data)
+ {
+ struct hash_entry *new_entry = allocate_entry (table);
+
+ if (new_entry == NULL)
+ return NULL;
+
+ /* Add ENTRY in the overflow of the bucket. */
+
+ new_entry->data = (void *) entry;
+ new_entry->next = bucket->next;
+ bucket->next = new_entry;
+ table->n_entries++;
+ return (void *) entry;
+ }
+
+ /* Add ENTRY right in the bucket head. */
+
+ bucket->data = (void *) entry;
+ table->n_entries++;
+ table->n_buckets_used++;
+
+ /* If the growth threshold of the buckets in use has been reached, increase
+ the table size and rehash. There's no point in checking the number of
+ entries: if the hashing function is ill-conditioned, rehashing is not
+ likely to improve it. */
+
+ if (table->n_buckets_used
+ > table->tuning->growth_threshold * table->n_buckets)
+ {
+ /* Check more fully, before starting real work. If tuning arguments
+ became invalid, the second check will rely on proper defaults. */
+ check_tuning (table);
+ if (table->n_buckets_used
+ > table->tuning->growth_threshold * table->n_buckets)
+ {
+ const Hash_tuning *tuning = table->tuning;
+ float candidate =
+ (tuning->is_n_buckets
+ ? (table->n_buckets * tuning->growth_factor)
+ : (table->n_buckets * tuning->growth_factor
+ * tuning->growth_threshold));
+
+ if (SIZE_MAX <= candidate)
+ return NULL;
+
+ /* If the rehash fails, arrange to return NULL. */
+ if (!hash_rehash (table, candidate))
+ entry = NULL;
+ }
+ }
+
+ return (void *) entry;
+}
+
+/* If ENTRY is already in the table, remove it and return the just-deleted
+ data (the user may want to deallocate its storage). If ENTRY is not in the
+ table, don't modify the table and return NULL. */
+
+void *
+hash_delete (Hash_table *table, const void *entry)
+{
+ void *data;
+ struct hash_entry *bucket;
+
+ data = hash_find_entry (table, entry, &bucket, true);
+ if (!data)
+ return NULL;
+
+ table->n_entries--;
+ if (!bucket->data)
+ {
+ table->n_buckets_used--;
+
+ /* If the shrink threshold of the buckets in use has been reached,
+ rehash into a smaller table. */
+
+ if (table->n_buckets_used
+ < table->tuning->shrink_threshold * table->n_buckets)
+ {
+ /* Check more fully, before starting real work. If tuning arguments
+ became invalid, the second check will rely on proper defaults. */
+ check_tuning (table);
+ if (table->n_buckets_used
+ < table->tuning->shrink_threshold * table->n_buckets)
+ {
+ const Hash_tuning *tuning = table->tuning;
+ size_t candidate =
+ (tuning->is_n_buckets
+ ? table->n_buckets * tuning->shrink_factor
+ : (table->n_buckets * tuning->shrink_factor
+ * tuning->growth_threshold));
+
+ hash_rehash (table, candidate);
+ }
+ }
+ }
+
+ return data;
+}
+
+/* Testing. */
+
+#if TESTING
+
+void
+hash_print (const Hash_table *table)
+{
+ struct hash_entry const *bucket;
+
+ for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
+ {
+ struct hash_entry *cursor;
+
+ if (bucket)
+ printf ("%lu:\n", (unsigned long int) (bucket - table->bucket));
+
+ for (cursor = bucket; cursor; cursor = cursor->next)
+ {
+ char const *s = cursor->data;
+ /* FIXME */
+ if (s)
+ printf (" %s\n", s);
+ }
+ }
+}
+
+#endif /* TESTING */
diff --git a/gnulib/lib/hash.h b/gnulib/lib/hash.h
new file mode 100644
index 00000000..fc1af28a
--- /dev/null
+++ b/gnulib/lib/hash.h
@@ -0,0 +1,87 @@
+/* hash - hashing table processing.
+ Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Written by Jim Meyering <meyering@ascend.com>, 1998.
+
+ 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 <http://www.gnu.org/licenses/>. */
+
+/* A generic hash table package. */
+
+/* Make sure USE_OBSTACK is defined to 1 if you want the allocator to use
+ obstacks instead of malloc, and recompile `hash.c' with same setting. */
+
+#ifndef HASH_H_
+# define HASH_H_
+
+# include <stdio.h>
+# include <stdbool.h>
+
+typedef size_t (*Hash_hasher) (const void *, size_t);
+typedef bool (*Hash_comparator) (const void *, const void *);
+typedef void (*Hash_data_freer) (void *);
+typedef bool (*Hash_processor) (void *, void *);
+
+struct hash_entry
+ {
+ void *data;
+ struct hash_entry *next;
+ };
+
+struct hash_tuning
+ {
+ /* This structure is mainly used for `hash_initialize', see the block
+ documentation of `hash_reset_tuning' for more complete comments. */
+
+ float shrink_threshold; /* ratio of used buckets to trigger a shrink */
+ float shrink_factor; /* ratio of new smaller size to original size */
+ float growth_threshold; /* ratio of used buckets to trigger a growth */
+ float growth_factor; /* ratio of new bigger size to original size */
+ bool is_n_buckets; /* if CANDIDATE really means table size */
+ };
+
+typedef struct hash_tuning Hash_tuning;
+
+struct hash_table;
+
+typedef struct hash_table Hash_table;
+
+/* Information and lookup. */
+size_t hash_get_n_buckets (const Hash_table *);
+size_t hash_get_n_buckets_used (const Hash_table *);
+size_t hash_get_n_entries (const Hash_table *);
+size_t hash_get_max_bucket_length (const Hash_table *);
+bool hash_table_ok (const Hash_table *);
+void hash_print_statistics (const Hash_table *, FILE *);
+void *hash_lookup (const Hash_table *, const void *);
+
+/* Walking. */
+void *hash_get_first (const Hash_table *);
+void *hash_get_next (const Hash_table *, const void *);
+size_t hash_get_entries (const Hash_table *, void **, size_t);
+size_t hash_do_for_each (const Hash_table *, Hash_processor, void *);
+
+/* Allocation and clean-up. */
+size_t hash_string (const char *, size_t);
+void hash_reset_tuning (Hash_tuning *);
+Hash_table *hash_initialize (size_t, const Hash_tuning *,
+ Hash_hasher, Hash_comparator,
+ Hash_data_freer);
+void hash_clear (Hash_table *);
+void hash_free (Hash_table *);
+
+/* Insertion and deletion. */
+bool hash_rehash (Hash_table *, size_t);
+void *hash_insert (Hash_table *, const void *);
+void *hash_delete (Hash_table *, const void *);
+
+#endif
diff --git a/gnulib/lib/intprops.h b/gnulib/lib/intprops.h
new file mode 100644
index 00000000..002161ee
--- /dev/null
+++ b/gnulib/lib/intprops.h
@@ -0,0 +1,77 @@
+/* intprops.h -- properties of integer types
+
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <limits.h>
+
+/* The extra casts in the following macros work around compiler bugs,
+ e.g., in Cray C 5.0.3.0. */
+
+/* True if the arithmetic type T is an integer type. bool counts as
+ an integer. */
+#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+
+/* True if negative values of the signed integer type T use two's
+ complement, ones' complement, or signed magnitude representation,
+ respectively. Much GNU code assumes two's complement, but some
+ people like to be portable to all possible C hosts. */
+#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
+#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
+#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+
+/* True if the arithmetic type T is signed. */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
+/* The maximum and minimum values for the integer type T. These
+ macros have undefined behavior if T is signed and has padding bits.
+ If this is a problem for you, please let us know how to fix it for
+ your host. */
+#define TYPE_MINIMUM(t) \
+ ((t) (! TYPE_SIGNED (t) \
+ ? (t) 0 \
+ : TYPE_SIGNED_MAGNITUDE (t) \
+ ? ~ (t) 0 \
+ : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+#define TYPE_MAXIMUM(t) \
+ ((t) (! TYPE_SIGNED (t) \
+ ? (t) -1 \
+ : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+
+/* Return zero if T can be determined to be an unsigned type.
+ Otherwise, return 1.
+ When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
+ tighter bound. Otherwise, it overestimates the true bound by one byte
+ when applied to unsigned types of size 2, 4, 16, ... bytes.
+ The symbol signed_type_or_expr__ is private to this header file. */
+#if __GNUC__ >= 2
+# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
+#else
+# define signed_type_or_expr__(t) 1
+#endif
+
+/* Bound on length of the string representing an integer type or expression T.
+ Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
+ add 1 for integer division truncation; add 1 more for a minus sign
+ if needed. */
+#define INT_STRLEN_BOUND(t) \
+ ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
+ + signed_type_or_expr__ (t) + 1)
+
+/* Bound on buffer size needed to represent an integer type or expression T,
+ including the terminating null. */
+#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
diff --git a/gnulib/lib/lchown.c b/gnulib/lib/lchown.c
new file mode 100644
index 00000000..07aef873
--- /dev/null
+++ b/gnulib/lib/lchown.c
@@ -0,0 +1,62 @@
+/* Provide a stub lchown function for systems that lack it.
+
+ Copyright (C) 1998, 1999, 2002, 2004, 2006, 2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* If the system chown does not follow symlinks, we don't want it
+ replaced by gnulib's chown, which does follow symlinks. */
+#if CHOWN_MODIFIES_SYMLINK
+# define REPLACE_CHOWN 0
+#endif
+#include <unistd.h>
+
+#include <errno.h>
+#include <sys/stat.h>
+
+/* Some systems don't have EOPNOTSUPP. */
+#ifndef EOPNOTSUPP
+# ifdef ENOTSUP
+# define EOPNOTSUPP ENOTSUP
+# else
+/* Some systems don't have ENOTSUP either. */
+# define EOPNOTSUPP EINVAL
+# endif
+#endif
+
+/* Work just like chown, except when FILE is a symbolic link.
+ In that case, set errno to EOPNOTSUPP and return -1.
+ But if autoconf tests determined that chown modifies
+ symlinks, then just call chown. */
+
+int
+lchown (const char *file, uid_t uid, gid_t gid)
+{
+#if ! CHOWN_MODIFIES_SYMLINK
+ struct stat stats;
+
+ if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode))
+ {
+ errno = EOPNOTSUPP;
+ return -1;
+ }
+#endif
+
+ return chown (file, uid, gid);
+}
diff --git a/gnulib/lib/localcharset.c b/gnulib/lib/localcharset.c
index a0f7cca6..4f319487 100644
--- a/gnulib/lib/localcharset.c
+++ b/gnulib/lib/localcharset.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/localcharset.h b/gnulib/lib/localcharset.h
index 5030210d..b9a3013a 100644
--- a/gnulib/lib/localcharset.h
+++ b/gnulib/lib/localcharset.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/lock.c b/gnulib/lib/lock.c
index 34a59ab3..73cdc411 100644
--- a/gnulib/lib/lock.c
+++ b/gnulib/lib/lock.c
@@ -1,9 +1,9 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005-2006 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007 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 2, or (at your option)
+ 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,
@@ -250,7 +250,24 @@ glthread_rwlock_destroy (gl_rwlock_t *lock)
# if HAVE_PTHREAD_MUTEX_RECURSIVE
-# if !(defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+void
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+ pthread_mutexattr_t attributes;
+
+ if (pthread_mutexattr_init (&attributes) != 0)
+ abort ();
+ if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0)
+ abort ();
+ if (pthread_mutex_init (lock, &attributes) != 0)
+ abort ();
+ if (pthread_mutexattr_destroy (&attributes) != 0)
+ abort ();
+}
+
+# else
void
glthread_recursive_lock_init (gl_recursive_lock_t *lock)
diff --git a/gnulib/lib/lock.h b/gnulib/lib/lock.h
index e6b312af..0494732c 100644
--- a/gnulib/lib/lock.h
+++ b/gnulib/lib/lock.h
@@ -1,9 +1,9 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005-2006 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007 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 2, or (at your option)
+ 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,
@@ -147,13 +147,33 @@ typedef pthread_mutex_t gl_lock_t;
# define gl_lock_initializer \
PTHREAD_MUTEX_INITIALIZER
# define gl_lock_init(NAME) \
- if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_lock(NAME) \
- if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_unlock(NAME) \
- if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_destroy(NAME) \
- if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
/* ------------------------- gl_rwlock_t datatype ------------------------- */
@@ -169,15 +189,40 @@ typedef pthread_rwlock_t gl_rwlock_t;
# define gl_rwlock_initializer \
PTHREAD_RWLOCK_INITIALIZER
# define gl_rwlock_init(NAME) \
- if (pthread_in_use () && pthread_rwlock_init (&NAME, NULL) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_rwlock_init (&NAME, NULL) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_rdlock(NAME) \
- if (pthread_in_use () && pthread_rwlock_rdlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_rwlock_rdlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_wrlock(NAME) \
- if (pthread_in_use () && pthread_rwlock_wrlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_rwlock_wrlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_unlock(NAME) \
- if (pthread_in_use () && pthread_rwlock_unlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_rwlock_unlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_destroy(NAME) \
- if (pthread_in_use () && pthread_rwlock_destroy (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_rwlock_destroy (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# else
@@ -195,15 +240,40 @@ typedef struct
# define gl_rwlock_initializer \
{ 0, PTHREAD_MUTEX_INITIALIZER }
# define gl_rwlock_init(NAME) \
- if (pthread_in_use ()) glthread_rwlock_init (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_init (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_rdlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_rdlock (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_wrlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_wrlock (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_unlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_unlock (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_destroy(NAME) \
- if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_destroy (&NAME); \
+ } \
+ while (0)
extern void glthread_rwlock_init (gl_rwlock_t *lock);
extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
@@ -230,15 +300,40 @@ typedef struct
# define gl_rwlock_initializer \
{ PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
# define gl_rwlock_init(NAME) \
- if (pthread_in_use ()) glthread_rwlock_init (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_init (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_rdlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_rdlock (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_wrlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_wrlock (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_unlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_unlock (&NAME); \
+ } \
+ while (0)
# define gl_rwlock_destroy(NAME) \
- if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_rwlock_destroy (&NAME); \
+ } \
+ while (0)
extern void glthread_rwlock_init (gl_rwlock_t *lock);
extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
@@ -266,13 +361,34 @@ typedef pthread_mutex_t gl_recursive_lock_t;
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
# endif
# define gl_recursive_lock_init(NAME) \
- if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_init (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_lock(NAME) \
- if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_recursive_lock_unlock(NAME) \
- if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_recursive_lock_destroy(NAME) \
- if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
+ do \
+ { \
+ if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
+extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
# else
@@ -290,13 +406,33 @@ typedef struct
# define gl_recursive_lock_initializer \
{ PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 }
# define gl_recursive_lock_init(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_init (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_lock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_lock (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_unlock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_unlock (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_destroy(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_destroy (&NAME); \
+ } \
+ while (0)
extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
@@ -323,13 +459,33 @@ typedef struct
# define gl_recursive_lock_initializer \
{ PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 }
# define gl_recursive_lock_init(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_init (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_lock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_lock (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_unlock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_unlock (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_destroy(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+ do \
+ { \
+ if (pthread_in_use ()) \
+ glthread_recursive_lock_destroy (&NAME); \
+ } \
+ while (0)
extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
@@ -409,11 +565,26 @@ typedef pth_mutex_t gl_lock_t;
# define gl_lock_initializer \
PTH_MUTEX_INIT
# define gl_lock_init(NAME) \
- if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_mutex_init (&NAME)) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_lock(NAME) \
- if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_unlock(NAME) \
- if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_mutex_release (&NAME)) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_destroy(NAME) \
(void)(&NAME)
@@ -427,13 +598,35 @@ typedef pth_rwlock_t gl_rwlock_t;
# define gl_rwlock_initializer \
PTH_RWLOCK_INIT
# define gl_rwlock_init(NAME) \
- if (pth_in_use() && !pth_rwlock_init (&NAME)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_rwlock_init (&NAME)) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_rdlock(NAME) \
- if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RD, 0, NULL)) abort ()
+ do \
+ { \
+ if (pth_in_use() \
+ && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RD, 0, NULL)) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_wrlock(NAME) \
- if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RW, 0, NULL)) abort ()
+ do \
+ { \
+ if (pth_in_use() \
+ && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RW, 0, NULL)) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_unlock(NAME) \
- if (pth_in_use() && !pth_rwlock_release (&NAME)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_rwlock_release (&NAME)) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_destroy(NAME) \
(void)(&NAME)
@@ -448,11 +641,26 @@ typedef pth_mutex_t gl_recursive_lock_t;
# define gl_recursive_lock_initializer \
PTH_MUTEX_INIT
# define gl_recursive_lock_init(NAME) \
- if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_mutex_init (&NAME)) \
+ abort (); \
+ } \
+ while (0)
# define gl_recursive_lock_lock(NAME) \
- if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) \
+ abort (); \
+ } \
+ while (0)
# define gl_recursive_lock_unlock(NAME) \
- if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
+ do \
+ { \
+ if (pth_in_use() && !pth_mutex_release (&NAME)) \
+ abort (); \
+ } \
+ while (0)
# define gl_recursive_lock_destroy(NAME) \
(void)(&NAME)
@@ -534,13 +742,33 @@ typedef mutex_t gl_lock_t;
# define gl_lock_initializer \
DEFAULTMUTEX
# define gl_lock_init(NAME) \
- if (thread_in_use () && mutex_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && mutex_init (&NAME, USYNC_THREAD, NULL) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_lock(NAME) \
- if (thread_in_use () && mutex_lock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && mutex_lock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_unlock(NAME) \
- if (thread_in_use () && mutex_unlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && mutex_unlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_lock_destroy(NAME) \
- if (thread_in_use () && mutex_destroy (&NAME) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && mutex_destroy (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
/* ------------------------- gl_rwlock_t datatype ------------------------- */
@@ -552,15 +780,40 @@ typedef rwlock_t gl_rwlock_t;
# define gl_rwlock_initializer \
DEFAULTRWLOCK
# define gl_rwlock_init(NAME) \
- if (thread_in_use () && rwlock_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && rwlock_init (&NAME, USYNC_THREAD, NULL) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_rdlock(NAME) \
- if (thread_in_use () && rw_rdlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && rw_rdlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_wrlock(NAME) \
- if (thread_in_use () && rw_wrlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && rw_wrlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_unlock(NAME) \
- if (thread_in_use () && rw_unlock (&NAME) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && rw_unlock (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
# define gl_rwlock_destroy(NAME) \
- if (thread_in_use () && rwlock_destroy (&NAME) != 0) abort ()
+ do \
+ { \
+ if (thread_in_use () && rwlock_destroy (&NAME) != 0) \
+ abort (); \
+ } \
+ while (0)
/* --------------------- gl_recursive_lock_t datatype --------------------- */
@@ -581,13 +834,33 @@ typedef struct
# define gl_recursive_lock_initializer \
{ DEFAULTMUTEX, (thread_t) 0, 0 }
# define gl_recursive_lock_init(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_init (&NAME)
+ do \
+ { \
+ if (thread_in_use ()) \
+ glthread_recursive_lock_init (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_lock(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_lock (&NAME)
+ do \
+ { \
+ if (thread_in_use ()) \
+ glthread_recursive_lock_lock (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_unlock(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+ do \
+ { \
+ if (thread_in_use ()) \
+ glthread_recursive_lock_unlock (&NAME); \
+ } \
+ while (0)
# define gl_recursive_lock_destroy(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+ do \
+ { \
+ if (thread_in_use ()) \
+ glthread_recursive_lock_destroy (&NAME); \
+ } \
+ while (0)
extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
diff --git a/gnulib/lib/lstat.c b/gnulib/lib/lstat.c
new file mode 100644
index 00000000..9dcb4cdc
--- /dev/null
+++ b/gnulib/lib/lstat.c
@@ -0,0 +1,75 @@
+/* Work around a bug of lstat on some systems
+
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* The specification of these functions is in sys_stat.h. But we cannot
+ include this include file here, because on some systems, a
+ "#define lstat lstat64" is being used, and sys_stat.h deletes this
+ definition. */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+
+/* lstat works differently on Linux and Solaris systems. POSIX (see
+ `pathname resolution' in the glossary) requires that programs like
+ `ls' take into consideration the fact that FILE has a trailing slash
+ when FILE is a symbolic link. On Linux and Solaris 10 systems, the
+ lstat function already has the desired semantics (in treating
+ `lstat ("symlink/", sbuf)' just like `lstat ("symlink/.", sbuf)',
+ but on Solaris 9 and earlier it does not.
+
+ If FILE has a trailing slash and specifies a symbolic link,
+ then use stat() to get more info on the referent of FILE.
+ If the referent is a non-directory, then set errno to ENOTDIR
+ and return -1. Otherwise, return stat's result. */
+
+int
+rpl_lstat (const char *file, struct stat *sbuf)
+{
+ size_t len;
+ int lstat_result = lstat (file, sbuf);
+
+ if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode))
+ return lstat_result;
+
+ len = strlen (file);
+ if (len == 0 || file[len - 1] != '/')
+ return 0;
+
+ /* FILE refers to a symbolic link and the name ends with a slash.
+ Call stat() to get info about the link's referent. */
+
+ /* If stat fails, then we do the same. */
+ if (stat (file, sbuf) != 0)
+ return -1;
+
+ /* If FILE references a directory, return 0. */
+ if (S_ISDIR (sbuf->st_mode))
+ return 0;
+
+ /* Here, we know stat succeeded and FILE references a non-directory.
+ But it was specified via a name including a trailing slash.
+ Fail with errno set to ENOTDIR to indicate the contradiction. */
+ errno = ENOTDIR;
+ return -1;
+}
diff --git a/gnulib/lib/lstat.h b/gnulib/lib/lstat.h
new file mode 100644
index 00000000..63b21c89
--- /dev/null
+++ b/gnulib/lib/lstat.h
@@ -0,0 +1,23 @@
+/* Retrieving information about files.
+ Copyright (C) 2005 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 <http://www.gnu.org/licenses/>. */
+
+#include <sys/stat.h>
+
+#if !LSTAT_FOLLOWS_SLASHED_SYMLINK
+extern int rpl_lstat (const char *name, struct stat *buf);
+# undef lstat
+# define lstat rpl_lstat
+#endif
diff --git a/gnulib/lib/malloc.c b/gnulib/lib/malloc.c
index eba131d1..f2f66637 100644
--- a/gnulib/lib/malloc.c
+++ b/gnulib/lib/malloc.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/malloca.c b/gnulib/lib/malloca.c
index 4145bf6d..1f410781 100644
--- a/gnulib/lib/malloca.c
+++ b/gnulib/lib/malloca.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/malloca.h b/gnulib/lib/malloca.h
index 2f74b961..c3c9576d 100644
--- a/gnulib/lib/malloca.h
+++ b/gnulib/lib/malloca.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/memcmp.c b/gnulib/lib/memcmp.c
index cf98bfab..78735f5e 100644
--- a/gnulib/lib/memcmp.c
+++ b/gnulib/lib/memcmp.c
@@ -6,9 +6,9 @@
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
- This program is free software; you can redistribute it and/or modify it
+ 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 2, or (at your option) any
+ Free Software Foundation; either version 3 of the License, or any
later version.
This program is distributed in the hope that it will be useful,
@@ -17,9 +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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>
diff --git a/gnulib/lib/mempcpy.c b/gnulib/lib/mempcpy.c
index 1c702c7f..33c7a607 100644
--- a/gnulib/lib/mempcpy.c
+++ b/gnulib/lib/mempcpy.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/memrchr.c b/gnulib/lib/memrchr.c
new file mode 100644
index 00000000..50b27c02
--- /dev/null
+++ b/gnulib/lib/memrchr.c
@@ -0,0 +1,189 @@
+/* memrchr -- find the last occurrence of a byte in a memory block
+
+ Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
+
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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 <http://www.gnu.org/licenses/>. */
+
+#if defined _LIBC
+# include <memcopy.h>
+#else
+# include <config.h>
+# define reg_char char
+#endif
+
+#include <string.h>
+#include <limits.h>
+
+#undef __memrchr
+#undef memrchr
+
+#ifndef weak_alias
+# define __memrchr memrchr
+#endif
+
+/* Search no more than N bytes of S for C. */
+void *
+__memrchr (void const *s, int c_in, size_t n)
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+ int i;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the last few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s + n;
+ n > 0 && (size_t) char_ptr % sizeof longword != 0;
+ --n)
+ if (*--char_ptr == c)
+ return (void *) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to any size longwords. */
+
+ longword_ptr = (const unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+
+ /* Set MAGIC_BITS to be this pattern of 1 and 0 bits.
+ Set CHARMASK to be a longword, each of whose bytes is C. */
+
+ magic_bits = 0xfefefefe;
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+#if 0xffffffffU < ULONG_MAX
+ magic_bits |= magic_bits << 32;
+ charmask |= charmask << 32;
+ if (8 < sizeof longword)
+ for (i = 64; i < sizeof longword * 8; i *= 2)
+ {
+ magic_bits |= magic_bits << i;
+ charmask |= charmask << i;
+ }
+#endif
+ magic_bits = (ULONG_MAX >> 1) & (magic_bits | 1);
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (n >= sizeof longword)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *--longword_ptr ^ charmask;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C? If none of them were, it was
+ a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) longword_ptr;
+
+ if (8 < sizeof longword)
+ for (i = sizeof longword - 1; 8 <= i; i--)
+ if (cp[i] == c)
+ return (void *) &cp[i];
+ if (7 < sizeof longword && cp[7] == c)
+ return (void *) &cp[7];
+ if (6 < sizeof longword && cp[6] == c)
+ return (void *) &cp[6];
+ if (5 < sizeof longword && cp[5] == c)
+ return (void *) &cp[5];
+ if (4 < sizeof longword && cp[4] == c)
+ return (void *) &cp[4];
+ if (cp[3] == c)
+ return (void *) &cp[3];
+ if (cp[2] == c)
+ return (void *) &cp[2];
+ if (cp[1] == c)
+ return (void *) &cp[1];
+ if (cp[0] == c)
+ return (void *) cp;
+ }
+
+ n -= sizeof longword;
+ }
+
+ char_ptr = (const unsigned char *) longword_ptr;
+
+ while (n-- > 0)
+ {
+ if (*--char_ptr == c)
+ return (void *) char_ptr;
+ }
+
+ return 0;
+}
+#ifdef weak_alias
+weak_alias (__memrchr, memrchr)
+#endif
diff --git a/gnulib/lib/minmax.h b/gnulib/lib/minmax.h
index 975ea76d..1ebc2207 100644
--- a/gnulib/lib/minmax.h
+++ b/gnulib/lib/minmax.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/mkdirat.c b/gnulib/lib/mkdirat.c
new file mode 100644
index 00000000..6b6278b1
--- /dev/null
+++ b/gnulib/lib/mkdirat.c
@@ -0,0 +1,42 @@
+/* fd-relative mkdir
+ Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "openat.h"
+
+#include <unistd.h>
+
+#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "save-cwd.h"
+#include "openat-priv.h"
+
+/* Solaris 10 has no function like this.
+ Create a subdirectory, FILE, with mode MODE, in the directory
+ open on descriptor FD. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ then mkdir/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero. */
+
+#define AT_FUNC_NAME mkdirat
+#define AT_FUNC_F1 mkdir
+#define AT_FUNC_F2 mkdir
+#define AT_FUNC_USE_F1_COND 1
+#define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode
+#define AT_FUNC_POST_FILE_ARGS , mode
+#include "at-func.c"
diff --git a/gnulib/lib/mkdtemp.c b/gnulib/lib/mkdtemp.c
index 36b6c757..6b9dd151 100644
--- a/gnulib/lib/mkdtemp.c
+++ b/gnulib/lib/mkdtemp.c
@@ -1,19 +1,18 @@
/* Copyright (C) 1999, 2001-2003, 2006-2007 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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Extracted from misc/mkdtemp.c. */
diff --git a/gnulib/lib/mkstemp.c b/gnulib/lib/mkstemp.c
index 57ee228e..1b052f9b 100644
--- a/gnulib/lib/mkstemp.c
+++ b/gnulib/lib/mkstemp.c
@@ -1,19 +1,18 @@
/* Copyright (C) 1998, 1999, 2001, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is derived from the one in the GNU C Library.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
# include <config.h>
diff --git a/gnulib/lib/open-safer.c b/gnulib/lib/open-safer.c
new file mode 100644
index 00000000..ce493d5e
--- /dev/null
+++ b/gnulib/lib/open-safer.c
@@ -0,0 +1,49 @@
+/* Invoke open, but avoid some glitches.
+
+ Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <config.h>
+
+#include "fcntl-safer.h"
+
+#include <fcntl.h>
+#include <stdarg.h>
+#include "unistd-safer.h"
+
+int
+open_safer (char const *file, int flags, ...)
+{
+ mode_t mode = 0;
+
+ if (flags & O_CREAT)
+ {
+ va_list ap;
+ va_start (ap, flags);
+
+ /* Assume mode_t promotes to int if and only if it is smaller.
+ This assumption isn't guaranteed by the C standard, but we
+ don't know of any real-world counterexamples. */
+ mode = (sizeof (mode_t) < sizeof (int)
+ ? va_arg (ap, int)
+ : va_arg (ap, mode_t));
+
+ va_end (ap);
+ }
+
+ return fd_safer (open (file, flags, mode));
+}
diff --git a/gnulib/lib/openat-die.c b/gnulib/lib/openat-die.c
new file mode 100644
index 00000000..6bc533d0
--- /dev/null
+++ b/gnulib/lib/openat-die.c
@@ -0,0 +1,50 @@
+/* Report a save- or restore-cwd failure in our openat replacement and then exit.
+
+ Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "error.h"
+#include "exitfail.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+void
+openat_save_fail (int errno)
+{
+ error (exit_failure, errno,
+ _("unable to record current working directory"));
+
+ /* The `noreturn' attribute cannot be applied to error, since it returns
+ when its first argument is 0. To help compilers understand that this
+ function does not return, call abort. Also, the abort is a
+ safety feature if exit_failure is 0 (which shouldn't happen). */
+ abort ();
+}
+
+void
+openat_restore_fail (int errno)
+{
+ error (exit_failure, errno,
+ _("failed to return to initial working directory"));
+
+ /* As above. */
+ abort ();
+}
diff --git a/gnulib/lib/openat-priv.h b/gnulib/lib/openat-priv.h
new file mode 100644
index 00000000..9254f6bb
--- /dev/null
+++ b/gnulib/lib/openat-priv.h
@@ -0,0 +1,54 @@
+/* Internals for openat-like functions.
+
+ Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <errno.h>
+#include <stdlib.h>
+
+#define OPENAT_BUFFER_SIZE 512
+char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file);
+
+/* Some systems don't have ENOSYS. */
+#ifndef ENOSYS
+# ifdef ENOTSUP
+# define ENOSYS ENOTSUP
+# else
+/* Some systems don't have ENOTSUP either. */
+# define ENOSYS EINVAL
+# endif
+#endif
+
+/* Some systems don't have EOPNOTSUPP. */
+#ifndef EOPNOTSUPP
+# ifdef ENOTSUP
+# define EOPNOTSUPP ENOTSUP
+# else
+/* Some systems don't have ENOTSUP either. */
+# define EOPNOTSUPP EINVAL
+# endif
+#endif
+
+/* Trying to access a BUILD_PROC_NAME file will fail on systems without
+ /proc support, and even on systems *with* ProcFS support. Return
+ nonzero if the failure may be legitimate, e.g., because /proc is not
+ readable, or the particular .../fd/N directory is not present. */
+#define EXPECTED_ERRNO(Errno) \
+ ((Errno) == ENOTDIR || (Errno) == ENOENT \
+ || (Errno) == EPERM || (Errno) == EACCES \
+ || (Errno) == ENOSYS /* Solaris 8 */ \
+ || (Errno) == EOPNOTSUPP /* FreeBSD */)
diff --git a/gnulib/lib/openat-proc.c b/gnulib/lib/openat-proc.c
new file mode 100644
index 00000000..e84dc454
--- /dev/null
+++ b/gnulib/lib/openat-proc.c
@@ -0,0 +1,94 @@
+/* Create /proc/self/fd-related names for subfiles of open directories.
+
+ Copyright (C) 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "dirname.h"
+#include "intprops.h"
+#include "same-inode.h"
+#include "xalloc.h"
+
+/* The results of open() in this file are not used with fchdir,
+ therefore save some unnecessary work in fchdir.c. */
+#undef open
+#undef close
+
+#define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/%s"
+
+#define PROC_SELF_FD_NAME_SIZE_BOUND(len) \
+ (sizeof PROC_SELF_FD_FORMAT - sizeof "%d%s" \
+ + INT_STRLEN_BOUND (int) + (len) + 1)
+
+
+/* Set BUF to the expansion of PROC_SELF_FD_FORMAT, using FD and FILE
+ respectively for %d and %s. If successful, return BUF if the
+ result fits in BUF, dynamically allocated memory otherwise. But
+ return NULL if /proc is not reliable. */
+char *
+openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file)
+{
+ static int proc_status = 0;
+
+ if (! proc_status)
+ {
+ /* Set PROC_STATUS to a positive value if /proc/self/fd is
+ reliable, and a negative value otherwise. Solaris 10
+ /proc/self/fd mishandles "..", and any file name might expand
+ to ".." after symbolic link expansion, so avoid /proc/self/fd
+ if it mishandles "..". Solaris 10 has openat, but this
+ problem is exhibited on code that built on Solaris 8 and
+ running on Solaris 10. */
+
+ int proc_self_fd = open ("/proc/self/fd", O_RDONLY);
+ if (proc_self_fd < 0)
+ proc_status = -1;
+ else
+ {
+ struct stat proc_self_fd_dotdot_st;
+ struct stat proc_self_st;
+ char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof ".." - 1)];
+ sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "..");
+ proc_status =
+ ((stat (dotdot_buf, &proc_self_fd_dotdot_st) == 0
+ && stat ("/proc/self", &proc_self_st) == 0
+ && SAME_INODE (proc_self_fd_dotdot_st, proc_self_st))
+ ? 1 : -1);
+ close (proc_self_fd);
+ }
+ }
+
+ if (proc_status < 0)
+ return NULL;
+ else
+ {
+ size_t bufsize = PROC_SELF_FD_NAME_SIZE_BOUND (strlen (file));
+ char *result = (bufsize < OPENAT_BUFFER_SIZE ? buf : xmalloc (bufsize));
+ sprintf (result, PROC_SELF_FD_FORMAT, fd, file);
+ return result;
+ }
+}
diff --git a/gnulib/lib/openat.c b/gnulib/lib/openat.c
new file mode 100644
index 00000000..73f24b06
--- /dev/null
+++ b/gnulib/lib/openat.c
@@ -0,0 +1,268 @@
+/* provide a replacement openat function
+ Copyright (C) 2004, 2005, 2006, 2007 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "openat.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "fcntl--.h"
+#include "lstat.h"
+#include "openat-priv.h"
+#include "save-cwd.h"
+
+/* Replacement for Solaris' openat function.
+ <http://www.google.com/search?q=openat+site:docs.sun.com>
+ First, try to simulate it via open ("/proc/self/fd/FD/FILE").
+ Failing that, simulate it by doing save_cwd/fchdir/open/restore_cwd.
+ If either the save_cwd or the restore_cwd fails (relatively unlikely),
+ then give a diagnostic and exit nonzero.
+ Otherwise, upon failure, set errno and return -1, as openat does.
+ Upon successful completion, return a file descriptor. */
+int
+openat (int fd, char const *file, int flags, ...)
+{
+ mode_t mode = 0;
+
+ if (flags & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, flags);
+
+ /* If mode_t is narrower than int, use the promoted type (int),
+ not mode_t. Use sizeof to guess whether mode_t is narrower;
+ we don't know of any practical counterexamples. */
+ mode = (sizeof (mode_t) < sizeof (int)
+ ? va_arg (arg, int)
+ : va_arg (arg, mode_t));
+
+ va_end (arg);
+ }
+
+ return openat_permissive (fd, file, flags, mode, NULL);
+}
+
+/* Like openat (FD, FILE, FLAGS, MODE), but if CWD_ERRNO is
+ nonnull, set *CWD_ERRNO to an errno value if unable to save
+ or restore the initial working directory. This is needed only
+ the first time remove.c's remove_dir opens a command-line
+ directory argument.
+
+ If a previous attempt to restore the current working directory
+ failed, then we must not even try to access a `.'-relative name.
+ It is the caller's responsibility not to call this function
+ in that case. */
+
+int
+openat_permissive (int fd, char const *file, int flags, mode_t mode,
+ int *cwd_errno)
+{
+ struct saved_cwd saved_cwd;
+ int saved_errno;
+ int err;
+ bool save_ok;
+
+ if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
+ return open (file, flags, mode);
+
+ {
+ char buf[OPENAT_BUFFER_SIZE];
+ char *proc_file = openat_proc_name (buf, fd, file);
+ if (proc_file)
+ {
+ int open_result = open (proc_file, flags, mode);
+ int open_errno = errno;
+ if (proc_file != buf)
+ free (proc_file);
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (0 <= open_result || ! EXPECTED_ERRNO (open_errno))
+ {
+ errno = open_errno;
+ return open_result;
+ }
+ }
+ }
+
+ save_ok = (save_cwd (&saved_cwd) == 0);
+ if (! save_ok)
+ {
+ if (! cwd_errno)
+ openat_save_fail (errno);
+ *cwd_errno = errno;
+ }
+
+ err = fchdir (fd);
+ saved_errno = errno;
+
+ if (! err)
+ {
+ err = open (file, flags, mode);
+ saved_errno = errno;
+ if (save_ok && restore_cwd (&saved_cwd) != 0)
+ {
+ if (! cwd_errno)
+ openat_restore_fail (errno);
+ *cwd_errno = errno;
+ }
+ }
+
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return err;
+}
+
+/* Return true if our openat implementation must resort to
+ using save_cwd and restore_cwd. */
+bool
+openat_needs_fchdir (void)
+{
+ bool needs_fchdir = true;
+ int fd = open ("/", O_RDONLY);
+
+ if (0 <= fd)
+ {
+ char buf[OPENAT_BUFFER_SIZE];
+ char *proc_file = openat_proc_name (buf, fd, ".");
+ if (proc_file)
+ {
+ needs_fchdir = false;
+ if (proc_file != buf)
+ free (proc_file);
+ }
+ close (fd);
+ }
+
+ return needs_fchdir;
+}
+
+#if !HAVE_FDOPENDIR
+
+/* Replacement for Solaris' function by the same name.
+ <http://www.google.com/search?q=fdopendir+site:docs.sun.com>
+ First, try to simulate it via opendir ("/proc/self/fd/FD"). Failing
+ that, simulate it by doing save_cwd/fchdir/opendir(".")/restore_cwd.
+ If either the save_cwd or the restore_cwd fails (relatively unlikely),
+ then give a diagnostic and exit nonzero.
+ Otherwise, this function works just like Solaris' fdopendir.
+
+ W A R N I N G:
+ Unlike the other fd-related functions here, this one
+ effectively consumes its FD parameter. The caller should not
+ close or otherwise manipulate FD if this function returns successfully. */
+DIR *
+fdopendir (int fd)
+{
+ struct saved_cwd saved_cwd;
+ int saved_errno;
+ DIR *dir;
+
+ char buf[OPENAT_BUFFER_SIZE];
+ char *proc_file = openat_proc_name (buf, fd, ".");
+ if (proc_file)
+ {
+ dir = opendir (proc_file);
+ saved_errno = errno;
+ }
+ else
+ {
+ dir = NULL;
+ saved_errno = EOPNOTSUPP;
+ }
+
+ /* If the syscall fails with an expected errno value, resort to
+ save_cwd/restore_cwd. */
+ if (! dir && EXPECTED_ERRNO (saved_errno))
+ {
+ if (save_cwd (&saved_cwd) != 0)
+ openat_save_fail (errno);
+
+ if (fchdir (fd) != 0)
+ {
+ dir = NULL;
+ saved_errno = errno;
+ }
+ else
+ {
+ dir = opendir (".");
+ saved_errno = errno;
+
+ if (restore_cwd (&saved_cwd) != 0)
+ openat_restore_fail (errno);
+ }
+
+ free_cwd (&saved_cwd);
+ }
+
+ if (dir)
+ close (fd);
+ if (proc_file != buf)
+ free (proc_file);
+ errno = saved_errno;
+ return dir;
+}
+
+#endif
+
+/* Replacement for Solaris' function by the same name.
+ <http://www.google.com/search?q=fstatat+site:docs.sun.com>
+ First, try to simulate it via l?stat ("/proc/self/fd/FD/FILE").
+ Failing that, simulate it via save_cwd/fchdir/(stat|lstat)/restore_cwd.
+ If either the save_cwd or the restore_cwd fails (relatively unlikely),
+ then give a diagnostic and exit nonzero.
+ Otherwise, this function works just like Solaris' fstatat. */
+
+#define AT_FUNC_NAME fstatat
+#define AT_FUNC_F1 lstat
+#define AT_FUNC_F2 stat
+#define AT_FUNC_USE_F1_COND flag == AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , struct stat *st, int flag
+#define AT_FUNC_POST_FILE_ARGS , st
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_F2
+#undef AT_FUNC_USE_F1_COND
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
+
+/* Replacement for Solaris' function by the same name.
+ <http://www.google.com/search?q=unlinkat+site:docs.sun.com>
+ First, try to simulate it via (unlink|rmdir) ("/proc/self/fd/FD/FILE").
+ Failing that, simulate it via save_cwd/fchdir/(unlink|rmdir)/restore_cwd.
+ If either the save_cwd or the restore_cwd fails (relatively unlikely),
+ then give a diagnostic and exit nonzero.
+ Otherwise, this function works just like Solaris' unlinkat. */
+
+#define AT_FUNC_NAME unlinkat
+#define AT_FUNC_F1 rmdir
+#define AT_FUNC_F2 unlink
+#define AT_FUNC_USE_F1_COND flag == AT_REMOVEDIR
+#define AT_FUNC_POST_FILE_PARAM_DECLS , int flag
+#define AT_FUNC_POST_FILE_ARGS /* empty */
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_F2
+#undef AT_FUNC_USE_F1_COND
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
diff --git a/gnulib/lib/openat.h b/gnulib/lib/openat.h
new file mode 100644
index 00000000..b5e4f116
--- /dev/null
+++ b/gnulib/lib/openat.h
@@ -0,0 +1,126 @@
+/* provide a replacement openat function
+ Copyright (C) 2004, 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
+# define __attribute__(x) /* empty */
+# endif
+#endif
+
+#ifndef ATTRIBUTE_NORETURN
+# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
+ value exceeds INT_MAX, so its use as an int doesn't conform to the
+ C standard, and GCC and Sun C complain in some cases. If the bug
+ is present, undef AT_FDCWD here, so it can be redefined below. */
+#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
+# undef AT_FDCWD
+#endif
+
+/* Use the same bit pattern as Solaris 9, but with the proper
+ signedness. The bit pattern is important, in case this actually is
+ Solaris with the above workaround. */
+#ifndef AT_FDCWD
+# define AT_FDCWD (-3041965)
+#endif
+
+/* Use the same values as Solaris 9. This shouldn't matter, but
+ there's no real reason to differ. */
+#ifndef AT_SYMLINK_NOFOLLOW
+# define AT_SYMLINK_NOFOLLOW 4096
+# define AT_REMOVEDIR 1
+#endif
+
+#ifdef __OPENAT_PREFIX
+
+# undef openat
+# define __OPENAT_CONCAT(x, y) x ## y
+# define __OPENAT_XCONCAT(x, y) __OPENAT_CONCAT (x, y)
+# define __OPENAT_ID(y) __OPENAT_XCONCAT (__OPENAT_PREFIX, y)
+# define openat __OPENAT_ID (openat)
+int openat (int fd, char const *file, int flags, /* mode_t mode */ ...);
+int openat_permissive (int fd, char const *file, int flags, mode_t mode,
+ int *cwd_errno);
+# if ! HAVE_FDOPENDIR
+# define fdopendir __OPENAT_ID (fdopendir)
+# endif
+DIR *fdopendir (int fd);
+# define fstatat __OPENAT_ID (fstatat)
+int fstatat (int fd, char const *file, struct stat *st, int flag);
+# define unlinkat __OPENAT_ID (unlinkat)
+int unlinkat (int fd, char const *file, int flag);
+bool openat_needs_fchdir (void);
+
+#else
+
+# define openat_permissive(Fd, File, Flags, Mode, Cwd_errno) \
+ openat (Fd, File, Flags, Mode)
+# define openat_needs_fchdir() false
+
+#endif
+
+#if HAVE_OPENAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK
+int rpl_fstatat (int fd, char const *file, struct stat *st, int flag);
+# if !COMPILING_FSTATAT
+# undef fstatat
+# define fstatat rpl_fstatat
+# endif
+#endif
+
+int mkdirat (int fd, char const *file, mode_t mode);
+void openat_restore_fail (int) ATTRIBUTE_NORETURN;
+void openat_save_fail (int) ATTRIBUTE_NORETURN;
+int fchmodat (int fd, char const *file, mode_t mode, int flag);
+int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag);
+
+/* Using these function names makes application code
+ slightly more readable than it would be with
+ fchownat (..., 0) or fchownat (..., AT_SYMLINK_NOFOLLOW). */
+static inline int
+chownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+ return fchownat (fd, file, owner, group, 0);
+}
+
+static inline int
+lchownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+ return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
+}
+
+static inline int
+chmodat (int fd, char const *file, mode_t mode)
+{
+ return fchmodat (fd, file, mode, 0);
+}
+
+static inline int
+lchmodat (int fd, char const *file, mode_t mode)
+{
+ return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
+}
diff --git a/gnulib/lib/pathmax.h b/gnulib/lib/pathmax.h
index 6941e457..a653f26e 100644
--- a/gnulib/lib/pathmax.h
+++ b/gnulib/lib/pathmax.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/pipe-safer.c b/gnulib/lib/pipe-safer.c
new file mode 100644
index 00000000..0fc68505
--- /dev/null
+++ b/gnulib/lib/pipe-safer.c
@@ -0,0 +1,56 @@
+/* Invoke pipe, but avoid some glitches.
+ Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+#include "unistd-safer.h"
+
+#include <unistd.h>
+#include <errno.h>
+
+/* Like pipe, but ensure that neither of the file descriptors is
+ STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. Fail with ENOSYS on
+ platforms that lack pipe. */
+
+int
+pipe_safer (int fd[2])
+{
+#if HAVE_PIPE
+ if (pipe (fd) == 0)
+ {
+ int i;
+ for (i = 0; i < 2; i++)
+ {
+ fd[i] = fd_safer (fd[i]);
+ if (fd[i] < 0)
+ {
+ int e = errno;
+ close (fd[1 - i]);
+ errno = e;
+ return -1;
+ }
+ }
+
+ return 0;
+ }
+#else
+ errno = ENOSYS;
+#endif
+
+ return -1;
+}
diff --git a/gnulib/lib/printf-args.c b/gnulib/lib/printf-args.c
index 49789146..871c720a 100644
--- a/gnulib/lib/printf-args.c
+++ b/gnulib/lib/printf-args.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/printf-args.h b/gnulib/lib/printf-args.h
index 6f75e2ae..67cb990c 100644
--- a/gnulib/lib/printf-args.h
+++ b/gnulib/lib/printf-args.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/printf-parse.c b/gnulib/lib/printf-parse.c
index 2e679809..ec73a264 100644
--- a/gnulib/lib/printf-parse.c
+++ b/gnulib/lib/printf-parse.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
@@ -49,7 +49,7 @@
#include <stddef.h>
/* Get intmax_t. */
-#ifdef IN_LIBINTL
+#if defined IN_LIBINTL || defined IN_LIBASPRINTF
# if HAVE_STDINT_H_WITH_UINTMAX
# include <stdint.h>
# endif
@@ -63,6 +63,9 @@
/* malloc(), realloc(), free(). */
#include <stdlib.h>
+/* errno. */
+#include <errno.h>
+
/* Checked size_t computations. */
#include "xsize.h"
@@ -89,7 +92,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
if (d->dir == NULL)
/* Out of memory. */
- return -1;
+ goto out_of_memory_1;
a->count = 0;
a_allocated = 0;
@@ -109,13 +112,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
memory_size = xtimes (a_allocated, sizeof (argument)); \
if (size_overflow_p (memory_size)) \
/* Overflow, would lead to out of memory. */ \
- goto error; \
+ goto out_of_memory; \
memory = (argument *) (a->arg \
? realloc (a->arg, memory_size) \
: malloc (memory_size)); \
if (memory == NULL) \
/* Out of memory. */ \
- goto error; \
+ goto out_of_memory; \
a->arg = memory; \
} \
while (a->count <= n) \
@@ -539,11 +542,11 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
if (size_overflow_p (memory_size))
/* Overflow, would lead to out of memory. */
- goto error;
+ goto out_of_memory;
memory = (DIRECTIVE *) realloc (d->dir, memory_size);
if (memory == NULL)
/* Out of memory. */
- goto error;
+ goto out_of_memory;
d->dir = memory;
}
}
@@ -566,6 +569,16 @@ error:
free (a->arg);
if (d->dir)
free (d->dir);
+ errno = EINVAL;
+ return -1;
+
+out_of_memory:
+ if (a->arg)
+ free (a->arg);
+ if (d->dir)
+ free (d->dir);
+out_of_memory_1:
+ errno = ENOMEM;
return -1;
}
diff --git a/gnulib/lib/printf-parse.h b/gnulib/lib/printf-parse.h
index de7fc49b..e5d68d75 100644
--- a/gnulib/lib/printf-parse.h
+++ b/gnulib/lib/printf-parse.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/readlink.c b/gnulib/lib/readlink.c
index 3cbdc1c2..5cccdc96 100644
--- a/gnulib/lib/readlink.c
+++ b/gnulib/lib/readlink.c
@@ -1,10 +1,10 @@
/* Stub for readlink().
Copyright (C) 2003-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/ref-add.sin b/gnulib/lib/ref-add.sin
index bc5cc797..222d7529 100644
--- a/gnulib/lib/ref-add.sin
+++ b/gnulib/lib/ref-add.sin
@@ -4,7 +4,7 @@
#
# 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 2, or (at your option)
+# 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,
diff --git a/gnulib/lib/ref-del.sin b/gnulib/lib/ref-del.sin
index e9301bf2..1bf073e1 100644
--- a/gnulib/lib/ref-del.sin
+++ b/gnulib/lib/ref-del.sin
@@ -4,7 +4,7 @@
#
# 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 2, or (at your option)
+# 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,
diff --git a/gnulib/lib/regcomp.c b/gnulib/lib/regcomp.c
index fe4d243d..8827e03c 100644
--- a/gnulib/lib/regcomp.c
+++ b/gnulib/lib/regcomp.c
@@ -5,7 +5,7 @@
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 2, or (at your option)
+ 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,
@@ -1049,7 +1049,7 @@ optimize_utf8 (re_dfa_t *dfa)
mb_chars = true;
break;
case ANCHOR:
- switch (dfa->nodes[node].opr.idx)
+ switch (dfa->nodes[node].opr.ctx_type)
{
case LINE_FIRST:
case LINE_LAST:
diff --git a/gnulib/lib/regex.c b/gnulib/lib/regex.c
index d4eb726b..ee36378a 100644
--- a/gnulib/lib/regex.c
+++ b/gnulib/lib/regex.c
@@ -5,7 +5,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/regex.h b/gnulib/lib/regex.h
index 7a79ca37..a5312832 100644
--- a/gnulib/lib/regex.h
+++ b/gnulib/lib/regex.h
@@ -6,7 +6,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/regex_internal.c b/gnulib/lib/regex_internal.c
index 21298889..cf3bf1bb 100644
--- a/gnulib/lib/regex_internal.c
+++ b/gnulib/lib/regex_internal.c
@@ -6,7 +6,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/regex_internal.h b/gnulib/lib/regex_internal.h
index 5c07f936..f96291d0 100644
--- a/gnulib/lib/regex_internal.h
+++ b/gnulib/lib/regex_internal.h
@@ -5,7 +5,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/regexec.c b/gnulib/lib/regexec.c
index b1365708..ac6c258e 100644
--- a/gnulib/lib/regexec.c
+++ b/gnulib/lib/regexec.c
@@ -6,7 +6,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/rename.c b/gnulib/lib/rename.c
index 32d2b013..9667c39e 100644
--- a/gnulib/lib/rename.c
+++ b/gnulib/lib/rename.c
@@ -4,10 +4,10 @@
Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -15,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* written by Volker Borchert */
diff --git a/gnulib/lib/same-inode.h b/gnulib/lib/same-inode.h
index deca87b0..06327117 100644
--- a/gnulib/lib/same-inode.h
+++ b/gnulib/lib/same-inode.h
@@ -2,10 +2,10 @@
Copyright (C) 2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SAME_INODE_H
# define SAME_INODE_H 1
diff --git a/gnulib/lib/same.c b/gnulib/lib/same.c
new file mode 100644
index 00000000..af3a95ef
--- /dev/null
+++ b/gnulib/lib/same.c
@@ -0,0 +1,125 @@
+/* Determine whether two file names refer to the same file.
+
+ Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include <string.h>
+
+#include <limits.h>
+#ifndef _POSIX_NAME_MAX
+# define _POSIX_NAME_MAX 14
+#endif
+
+#include "same.h"
+#include "dirname.h"
+#include "error.h"
+#include "same-inode.h"
+#include "xalloc.h"
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* Return nonzero if SOURCE and DEST point to the same name in the same
+ directory. */
+
+bool
+same_name (const char *source, const char *dest)
+{
+ /* Compare the basenames. */
+ char const *source_basename = last_component (source);
+ char const *dest_basename = last_component (dest);
+ size_t source_baselen = base_len (source_basename);
+ size_t dest_baselen = base_len (dest_basename);
+ bool identical_basenames =
+ (source_baselen == dest_baselen
+ && memcmp (source_basename, dest_basename, dest_baselen) == 0);
+ bool compare_dirs = identical_basenames;
+ bool same = false;
+
+#if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
+ /* This implementation silently truncates components of file names. If
+ the base names might be truncated, check whether the truncated
+ base names are the same, while checking the directories. */
+ size_t slen_max = HAVE_LONG_FILE_NAMES ? 255 : _POSIX_NAME_MAX;
+ size_t min_baselen = MIN (source_baselen, dest_baselen);
+ if (slen_max <= min_baselen
+ && memcmp (source_basename, dest_basename, slen_max) == 0)
+ compare_dirs = true;
+#endif
+
+ if (compare_dirs)
+ {
+ struct stat source_dir_stats;
+ struct stat dest_dir_stats;
+ char *source_dirname, *dest_dirname;
+
+ /* Compare the parent directories (via the device and inode numbers). */
+ source_dirname = dir_name (source);
+ dest_dirname = dir_name (dest);
+
+ if (stat (source_dirname, &source_dir_stats))
+ {
+ /* Shouldn't happen. */
+ error (1, errno, "%s", source_dirname);
+ }
+
+ if (stat (dest_dirname, &dest_dir_stats))
+ {
+ /* Shouldn't happen. */
+ error (1, errno, "%s", dest_dirname);
+ }
+
+ same = SAME_INODE (source_dir_stats, dest_dir_stats);
+
+#if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
+ if (same && ! identical_basenames)
+ {
+ long name_max = (errno = 0, pathconf (dest_dirname, _PC_NAME_MAX));
+ if (name_max < 0)
+ {
+ if (errno)
+ {
+ /* Shouldn't happen. */
+ error (1, errno, "%s", dest_dirname);
+ }
+ same = false;
+ }
+ else
+ same = (name_max <= min_baselen
+ && memcmp (source_basename, dest_basename, name_max) == 0);
+ }
+#endif
+
+ free (source_dirname);
+ free (dest_dirname);
+ }
+
+ return same;
+}
diff --git a/gnulib/lib/same.h b/gnulib/lib/same.h
new file mode 100644
index 00000000..56e51cff
--- /dev/null
+++ b/gnulib/lib/same.h
@@ -0,0 +1,26 @@
+/* Determine whether two file names refer to the same file.
+
+ Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef SAME_H_
+# define SAME_H_ 1
+
+# include <stdbool.h>
+
+bool same_name (const char *source, const char *dest);
+
+#endif /* SAME_H_ */
diff --git a/gnulib/lib/save-cwd.c b/gnulib/lib/save-cwd.c
new file mode 100644
index 00000000..7618f090
--- /dev/null
+++ b/gnulib/lib/save-cwd.c
@@ -0,0 +1,102 @@
+/* save-cwd.c -- Save and restore current working directory.
+
+ Copyright (C) 1995, 1997, 1998, 2003, 2004, 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+#include "save-cwd.h"
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "chdir-long.h"
+#include "fcntl--.h"
+#include "xgetcwd.h"
+
+/* On systems without the fchdir function (WOE), pretend that open
+ always returns -1 so that save_cwd resorts to using xgetcwd.
+ Since chdir_long requires fchdir, use chdir instead. */
+#if !HAVE_FCHDIR
+# undef open
+# define open(File, Flags) (-1)
+# undef fchdir
+# define fchdir(Fd) (abort (), -1)
+# undef chdir_long
+# define chdir_long(Dir) chdir (Dir)
+#endif
+
+/* Record the location of the current working directory in CWD so that
+ the program may change to other directories and later use restore_cwd
+ to return to the recorded location. This function may allocate
+ space using malloc (via xgetcwd) or leave a file descriptor open;
+ use free_cwd to perform the necessary free or close. Upon failure,
+ no memory is allocated, any locally opened file descriptors are
+ closed; return non-zero -- in that case, free_cwd need not be
+ called, but doing so is ok. Otherwise, return zero.
+
+ The `raison d'etre' for this interface is that the working directory
+ is sometimes inaccessible, and getcwd is not robust or as efficient.
+ So, we prefer to use the open/fchdir approach, but fall back on
+ getcwd if necessary.
+
+ Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin,
+ SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it
+ doesn't work for partitions on which auditing is enabled. If
+ you're still using an obsolete system with these problems, please
+ send email to the maintainer of this code. */
+
+int
+save_cwd (struct saved_cwd *cwd)
+{
+ cwd->name = NULL;
+
+ cwd->desc = open (".", O_RDONLY);
+ if (cwd->desc < 0)
+ {
+ cwd->name = xgetcwd ();
+ return cwd->name ? 0 : -1;
+ }
+
+ return 0;
+}
+
+/* Change to recorded location, CWD, in directory hierarchy.
+ Upon failure, return -1 (errno is set by chdir or fchdir).
+ Upon success, return zero. */
+
+int
+restore_cwd (const struct saved_cwd *cwd)
+{
+ if (0 <= cwd->desc)
+ return fchdir (cwd->desc);
+ else
+ return chdir_long (cwd->name);
+}
+
+void
+free_cwd (struct saved_cwd *cwd)
+{
+ if (cwd->desc >= 0)
+ close (cwd->desc);
+ if (cwd->name)
+ free (cwd->name);
+}
diff --git a/gnulib/lib/save-cwd.h b/gnulib/lib/save-cwd.h
new file mode 100644
index 00000000..e23eb725
--- /dev/null
+++ b/gnulib/lib/save-cwd.h
@@ -0,0 +1,33 @@
+/* Save and restore current working directory.
+
+ Copyright (C) 1995, 1997, 1998, 2003 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#ifndef SAVE_CWD_H
+# define SAVE_CWD_H 1
+
+struct saved_cwd
+ {
+ int desc;
+ char *name;
+ };
+
+int save_cwd (struct saved_cwd *cwd);
+int restore_cwd (const struct saved_cwd *cwd);
+void free_cwd (struct saved_cwd *cwd);
+
+#endif /* SAVE_CWD_H */
diff --git a/gnulib/lib/setenv.c b/gnulib/lib/setenv.c
index 45802948..75488be0 100644
--- a/gnulib/lib/setenv.c
+++ b/gnulib/lib/setenv.c
@@ -1,19 +1,18 @@
/* Copyright (C) 1992,1995-1999,2000-2003,2005-2007 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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
# include <config.h>
diff --git a/gnulib/lib/setenv.h b/gnulib/lib/setenv.h
index 92e7bbaf..9f5d0b7e 100644
--- a/gnulib/lib/setenv.h
+++ b/gnulib/lib/setenv.h
@@ -1,10 +1,10 @@
/* Setting environment variables.
Copyright (C) 2001-2004, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if HAVE_SETENV || HAVE_UNSETENV
diff --git a/gnulib/lib/size_max.h b/gnulib/lib/size_max.h
index ed0bc137..2ccc5f08 100644
--- a/gnulib/lib/size_max.h
+++ b/gnulib/lib/size_max.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/sleep.c b/gnulib/lib/sleep.c
index 037559b0..9c56b9b8 100644
--- a/gnulib/lib/sleep.c
+++ b/gnulib/lib/sleep.c
@@ -2,10 +2,10 @@
Copyright (C) 2007 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/stdbool_.h b/gnulib/lib/stdbool.in.h
index 150a0102..171d70ab 100644
--- a/gnulib/lib/stdbool_.h
+++ b/gnulib/lib/stdbool.in.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
@@ -97,10 +97,11 @@ typedef bool _Bool;
"warning: _Bool is a keyword in ISO C99".
Use of an enum type, with IRIX cc, leads to a stupid
"warning(1185): enumerated type mixed with another type".
- The only benefit of the enum type, debuggability, is not important
- with these compilers. So use 'signed char' and no typedef. */
+ Even the existence of an enum type, without a typedef,
+ "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
+ The only benefit of the enum, debuggability, is not important
+ with these compilers. So use 'signed char' and no enum. */
# define _Bool signed char
-enum { false = 0, true = 1 };
# else
/* With this compiler, trust the _Bool type if the compiler has it. */
# if !@HAVE__BOOL@
diff --git a/gnulib/lib/stdint_.h b/gnulib/lib/stdint.in.h
index 121118cf..8aee8682 100644
--- a/gnulib/lib/stdint_.h
+++ b/gnulib/lib/stdint.in.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
@@ -101,7 +101,10 @@
#define _STDINT_MAX(signed, bits, zero) \
((signed) \
? ~ _STDINT_MIN (signed, bits, zero) \
- : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
+ : /* The expression for the unsigned case. The subtraction of (signed) \
+ is a nop in the unsigned case and avoids "signed integer overflow" \
+ warnings in the signed case. */ \
+ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
/* 7.18.1.1. Exact-width integer types */
@@ -247,6 +250,11 @@
# define uintmax_t unsigned long int
#endif
+/* Verify that intmax_t and uintmax_t have the same size. Too much code
+ breaks if this is not the case. If this check fails, the reason is likely
+ to be found in the autoconf macros. */
+typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
+
/* 7.18.2. Limits of specified-width integer types */
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
diff --git a/gnulib/lib/stdio_.h b/gnulib/lib/stdio.in.h
index 76d98563..8b88626a 100644
--- a/gnulib/lib/stdio_.h
+++ b/gnulib/lib/stdio.in.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
@@ -212,6 +212,32 @@ extern int vsprintf (char *str, const char *format, va_list args)
# endif
#endif
+#if @GNULIB_FOPEN@
+# if @REPLACE_FOPEN@
+# define fopen rpl_fopen
+extern FILE * fopen (const char *filename, const char *mode);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fopen
+# define fopen(f,m) \
+ (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
+ "use gnulib module fopen for portability"), \
+ fopen (f, m))
+#endif
+
+#if @GNULIB_FREOPEN@
+# if @REPLACE_FREOPEN@
+# define freopen rpl_freopen
+extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef freopen
+# define freopen(f,m,s) \
+ (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
+ "use gnulib module freopen for portability"), \
+ freopen (f, m, s))
+#endif
+
#if @GNULIB_FSEEKO@
# if @REPLACE_FSEEKO@
/* Provide fseek, fseeko functions that are aware of a preceding
@@ -308,12 +334,14 @@ extern long rpl_ftell (FILE *fp);
#if @GNULIB_GETDELIM@
# if !@HAVE_DECL_GETDELIM@
- /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
- NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
- NULL), pointing to *N characters of space. It is realloc'ed as
- necessary. Returns the number of characters read (not including
- the null terminator), or -1 on error or EOF. */
- extern ssize_t getdelim (char **, size_t *, int delim, FILE *);
+/* Read input, up to (and including) the next occurrence of DELIMITER, from
+ STREAM, store it in *LINEPTR (and NUL-terminate it).
+ *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
+ bytes of space. It is realloc'd as necessary.
+ Return the number of bytes read and stored at *LINEPTR (not including the
+ NUL terminator), or -1 on error or EOF. */
+extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
+ FILE *stream);
# endif
#elif defined GNULIB_POSIXCHECK
# undef getdelim
@@ -329,12 +357,13 @@ extern long rpl_ftell (FILE *fp);
# define getline rpl_getline
# endif
# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
- /* Read up to (and including) a newline from FP into *LINEPTR (and
- NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
- NULL), pointing to *N characters of space. It is realloc'ed as
- necessary. Returns the number of characters read (not including
- the null terminator), or -1 on error or EOF. */
- extern ssize_t getline (char **, size_t *, FILE *);
+/* Read a line, up to (and including) the next newline, from STREAM, store it
+ in *LINEPTR (and NUL-terminate it).
+ *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
+ bytes of space. It is realloc'd as necessary.
+ Return the number of bytes read and stored at *LINEPTR (not including the
+ NUL terminator), or -1 on error or EOF. */
+extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
# endif
#elif defined GNULIB_POSIXCHECK
# undef getline
diff --git a/gnulib/lib/stdlib_.h b/gnulib/lib/stdlib.in.h
index a4946e68..dc9f98f8 100644
--- a/gnulib/lib/stdlib_.h
+++ b/gnulib/lib/stdlib.in.h
@@ -2,10 +2,10 @@
Copyright (C) 1995, 2001-2002, 2006-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if defined __need_malloc_and_calloc
/* Special invocation convention inside glibc header files. */
@@ -168,6 +167,15 @@ extern int mkstemp (char * /*template*/);
#endif
+#if @GNULIB_PUTENV@
+# if @REPLACE_PUTENV@
+# undef putenv
+# define putenv rpl_putenv
+extern int putenv (char *string);
+# endif
+#endif
+
+
#ifdef __cplusplus
}
#endif
diff --git a/gnulib/lib/strcasecmp.c b/gnulib/lib/strcasecmp.c
index c605fb0f..bbfd570b 100644
--- a/gnulib/lib/strcasecmp.c
+++ b/gnulib/lib/strcasecmp.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/strchrnul.c b/gnulib/lib/strchrnul.c
index 07014be1..da4049dc 100644
--- a/gnulib/lib/strchrnul.c
+++ b/gnulib/lib/strchrnul.c
@@ -1,10 +1,10 @@
/* Searching in a string.
Copyright (C) 2003, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/strcspn.c b/gnulib/lib/strcspn.c
index 5a8d6f9c..0eecb8dc 100644
--- a/gnulib/lib/strcspn.c
+++ b/gnulib/lib/strcspn.c
@@ -3,9 +3,9 @@
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
- This program is free software; you can redistribute it and/or modify it
+ 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 2, or (at your option) any
+ Free Software Foundation; either version 3 of the License, or any
later version.
This program is distributed in the hope that it will be useful,
@@ -14,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/strdup.c b/gnulib/lib/strdup.c
index c6141087..bebe5c8f 100644
--- a/gnulib/lib/strdup.c
+++ b/gnulib/lib/strdup.c
@@ -5,7 +5,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/strerror.c b/gnulib/lib/strerror.c
index 54b851bd..9fe437db 100644
--- a/gnulib/lib/strerror.c
+++ b/gnulib/lib/strerror.c
@@ -1,12 +1,11 @@
-/* strerror.c --- ANSI C compatible system error routine
+/* strerror.c --- POSIX compatible system error routine
- Copyright (C) 1986, 1988, 1989, 1991, 2002, 2003, 2006, 2007 Free
- Software Foundation, Inc.
+ Copyright (C) 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -14,44 +13,37 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#if !HAVE_STRERROR
+#include <string.h>
-#include <limits.h>
+#if REPLACE_STRERROR
-/* Don't include <stdio.h>, since it may or may not declare
- sys_errlist and its declarations may collide with ours. Just
- declare the stuff that we need directly. Standard hosted C89
- implementations define strerror and they don't need this strerror
- function, so take some liberties with the standard to cater to
- ancient or limited freestanding implementations. */
-int sprintf (char *, char const *, ...);
-extern int sys_nerr;
-extern char *sys_errlist[];
+# include <stdio.h>
+
+# include "intprops.h"
+
+# undef strerror
+# if ! HAVE_DECL_STRERROR
+# define strerror(n) NULL
+# endif
char *
-strerror (int n)
+rpl_strerror (int n)
{
- static char const fmt[] = "Unknown error (%d)";
- static char mesg[sizeof fmt + sizeof n * CHAR_BIT / 3];
+ char *result = strerror (n);
- if (n < 0 || n >= sys_nerr)
+ if (result == NULL || result[0] == '\0')
{
+ static char const fmt[] = "Unknown error (%d)";
+ static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)];
sprintf (mesg, fmt, n);
return mesg;
}
- else
- return sys_errlist[n];
-}
-#else
-
-/* This declaration is solely to ensure that after preprocessing
- this file is never empty. */
-typedef int dummy;
+ return result;
+}
#endif
diff --git a/gnulib/lib/string_.h b/gnulib/lib/string.in.h
index bfb22b0e..f1cf99f3 100644
--- a/gnulib/lib/string_.h
+++ b/gnulib/lib/string.in.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
@@ -32,6 +32,7 @@
extern "C" {
#endif
+
/* Return the first occurrence of NEEDLE in HAYSTACK. */
#if @GNULIB_MEMMEM@
# if ! @HAVE_DECL_MEMMEM@
@@ -103,50 +104,6 @@ extern char *stpncpy (char *restrict __dst, char const *restrict __src,
stpncpy (a, b, n))
#endif
-/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
- greater than zero if S1 is lexicographically less than, equal to or greater
- than S2.
- Note: This function does not work in multibyte locales. */
-#if ! @HAVE_STRCASECMP@
-extern int strcasecmp (char const *s1, char const *s2);
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strcasecmp() does not work with multibyte strings:
- POSIX says that it operates on "strings", and "string" in POSIX is defined
- as a sequence of bytes, not of characters. */
-# undef strcasecmp
-# define strcasecmp(a,b) \
- (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
- "in multibyte locales - " \
- "use mbscasecmp if you care about " \
- "internationalization, or use c_strcasecmp (from " \
- "gnulib module c-strcase) if you want a locale " \
- "independent function"), \
- strcasecmp (a, b))
-#endif
-
-/* Compare no more than N bytes of strings S1 and S2, ignoring case,
- returning less than, equal to or greater than zero if S1 is
- lexicographically less than, equal to or greater than S2.
- Note: This function cannot work correctly in multibyte locales. */
-#if ! @HAVE_DECL_STRNCASECMP@
-extern int strncasecmp (char const *s1, char const *s2, size_t n);
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strncasecmp() does not work with multibyte strings:
- POSIX says that it operates on "strings", and "string" in POSIX is defined
- as a sequence of bytes, not of characters. */
-# undef strncasecmp
-# define strncasecmp(a,b,n) \
- (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
- "strings in multibyte locales - " \
- "use mbsncasecmp or mbspcasecmp if you care about " \
- "internationalization, or use c_strncasecmp (from " \
- "gnulib module c-strcase) if you want a locale " \
- "independent function"), \
- strncasecmp (a, b, n))
-#endif
-
#if defined GNULIB_POSIXCHECK
/* strchr() does not work with multibyte strings if the locale encoding is
GB18030 and the character to be searched is a digit. */
@@ -539,6 +496,21 @@ extern char * mbssep (char **stringp, const char *delim);
extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
#endif
+/* Map any int, typically from errno, into an error message. */
+#if @GNULIB_STRERROR@
+# if @REPLACE_STRERROR@
+# undef strerror
+# define strerror rpl_strerror
+extern char *strerror (int);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strerror
+# define strerror(e) \
+ (GL_LINK_WARNING ("strerror is unportable - " \
+ "use gnulib module strerror to guarantee non-NULL result"), \
+ strerror (e))
+#endif
+
#ifdef __cplusplus
}
diff --git a/gnulib/lib/strings.in.h b/gnulib/lib/strings.in.h
new file mode 100644
index 00000000..b1f87ca5
--- /dev/null
+++ b/gnulib/lib/strings.in.h
@@ -0,0 +1,86 @@
+/* A substitute <strings.h>.
+
+ Copyright (C) 2007 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, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _GL_STRINGS_H
+
+/* The include_next requires a split double-inclusion guard. */
+#@INCLUDE_NEXT@ @NEXT_STRINGS_H@
+
+#ifndef _GL_STRINGS_H
+#define _GL_STRINGS_H
+
+
+/* The definition of GL_LINK_WARNING is copied here. */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
+ greater than zero if S1 is lexicographically less than, equal to or greater
+ than S2.
+ Note: This function does not work in multibyte locales. */
+#if ! @HAVE_STRCASECMP@
+extern int strcasecmp (char const *s1, char const *s2);
+#endif
+#if defined GNULIB_POSIXCHECK
+/* strcasecmp() does not work with multibyte strings:
+ POSIX says that it operates on "strings", and "string" in POSIX is defined
+ as a sequence of bytes, not of characters. */
+# undef strcasecmp
+# define strcasecmp(a,b) \
+ (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
+ "in multibyte locales - " \
+ "use mbscasecmp if you care about " \
+ "internationalization, or use c_strcasecmp (from " \
+ "gnulib module c-strcase) if you want a locale " \
+ "independent function"), \
+ strcasecmp (a, b))
+#endif
+
+/* Compare no more than N bytes of strings S1 and S2, ignoring case,
+ returning less than, equal to or greater than zero if S1 is
+ lexicographically less than, equal to or greater than S2.
+ Note: This function cannot work correctly in multibyte locales. */
+#if ! @HAVE_DECL_STRNCASECMP@
+extern int strncasecmp (char const *s1, char const *s2, size_t n);
+#endif
+#if defined GNULIB_POSIXCHECK
+/* strncasecmp() does not work with multibyte strings:
+ POSIX says that it operates on "strings", and "string" in POSIX is defined
+ as a sequence of bytes, not of characters. */
+# undef strncasecmp
+# define strncasecmp(a,b,n) \
+ (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
+ "strings in multibyte locales - " \
+ "use mbsncasecmp or mbspcasecmp if you care about " \
+ "internationalization, or use c_strncasecmp (from " \
+ "gnulib module c-strcase) if you want a locale " \
+ "independent function"), \
+ strncasecmp (a, b, n))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_STRING_H */
+#endif /* _GL_STRING_H */
diff --git a/gnulib/lib/stripslash.c b/gnulib/lib/stripslash.c
index 342d497c..40844102 100644
--- a/gnulib/lib/stripslash.c
+++ b/gnulib/lib/stripslash.c
@@ -2,10 +2,10 @@
Copyright (C) 1990, 2001, 2003-2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/strncasecmp.c b/gnulib/lib/strncasecmp.c
index 473a610f..5e29a0a5 100644
--- a/gnulib/lib/strncasecmp.c
+++ b/gnulib/lib/strncasecmp.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/strndup.c b/gnulib/lib/strndup.c
index 3a1b0eae..507e9c06 100644
--- a/gnulib/lib/strndup.c
+++ b/gnulib/lib/strndup.c
@@ -5,7 +5,7 @@
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 2, or (at your option) any
+ 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,
diff --git a/gnulib/lib/strnlen.c b/gnulib/lib/strnlen.c
index d346d327..93d1ac14 100644
--- a/gnulib/lib/strnlen.c
+++ b/gnulib/lib/strnlen.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/strpbrk.c b/gnulib/lib/strpbrk.c
index 7843a6dd..a52c5f24 100644
--- a/gnulib/lib/strpbrk.c
+++ b/gnulib/lib/strpbrk.c
@@ -6,7 +6,7 @@
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 2, or (at your option) any
+ 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,
diff --git a/gnulib/lib/strsep.c b/gnulib/lib/strsep.c
index 9f2fdd2b..a5667843 100644
--- a/gnulib/lib/strsep.c
+++ b/gnulib/lib/strsep.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/sys_select_.h b/gnulib/lib/sys_select.in.h
index 05672026..49adc74c 100644
--- a/gnulib/lib/sys_select_.h
+++ b/gnulib/lib/sys_select.in.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/sys_socket_.h b/gnulib/lib/sys_socket.in.h
index c25b6ab8..5e0b097d 100644
--- a/gnulib/lib/sys_socket_.h
+++ b/gnulib/lib/sys_socket.in.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/sys_stat_.h b/gnulib/lib/sys_stat.in.h
index 2e411cd3..b60e3229 100644
--- a/gnulib/lib/sys_stat_.h
+++ b/gnulib/lib/sys_stat.in.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/sys_time_.h b/gnulib/lib/sys_time.in.h
index 296d20df..295d1645 100644
--- a/gnulib/lib/sys_time_.h
+++ b/gnulib/lib/sys_time.in.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/sysexits_.h b/gnulib/lib/sysexits.in.h
index b65e0ccc..895d31e9 100644
--- a/gnulib/lib/sysexits_.h
+++ b/gnulib/lib/sysexits.in.h
@@ -1,10 +1,10 @@
/* exit() exit codes for some BSD system programs.
Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Simon Josefsson based on sysexits(3) man page */
diff --git a/gnulib/lib/tempname.c b/gnulib/lib/tempname.c
index e213600e..5a3a3260 100644
--- a/gnulib/lib/tempname.c
+++ b/gnulib/lib/tempname.c
@@ -4,19 +4,18 @@
2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation,
Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */
diff --git a/gnulib/lib/tempname.h b/gnulib/lib/tempname.h
index c51fa694..74da03b3 100644
--- a/gnulib/lib/tempname.h
+++ b/gnulib/lib/tempname.h
@@ -2,10 +2,10 @@
Copyright (C) 2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* header written by Eric Blake */
diff --git a/gnulib/lib/unistd--.h b/gnulib/lib/unistd--.h
new file mode 100644
index 00000000..1a7fd785
--- /dev/null
+++ b/gnulib/lib/unistd--.h
@@ -0,0 +1,27 @@
+/* Like unistd.h, but redefine some names to avoid glitches.
+
+ Copyright (C) 2005 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <unistd.h>
+#include "unistd-safer.h"
+
+#undef dup
+#define dup dup_safer
+
+#undef pipe
+#define pipe pipe_safer
diff --git a/gnulib/lib/unistd-safer.h b/gnulib/lib/unistd-safer.h
new file mode 100644
index 00000000..033e857d
--- /dev/null
+++ b/gnulib/lib/unistd-safer.h
@@ -0,0 +1,22 @@
+/* Invoke unistd-like functions, but avoid some glitches.
+
+ Copyright (C) 2001, 2003, 2005 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 <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+int dup_safer (int);
+int fd_safer (int);
+int pipe_safer (int[2]);
diff --git a/gnulib/lib/unistd_.h b/gnulib/lib/unistd.in.h
index 07c48778..a2248895 100644
--- a/gnulib/lib/unistd_.h
+++ b/gnulib/lib/unistd.in.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
@@ -180,6 +180,61 @@ extern int getlogin_r (char *name, size_t size);
#endif
+#if @GNULIB_GETPAGESIZE@
+# if !@HAVE_GETPAGESIZE@
+/* This is for POSIX systems. */
+# if !defined getpagesize && defined _SC_PAGESIZE
+# if ! (defined __VMS && __VMS_VER < 70000000)
+# define getpagesize() sysconf (_SC_PAGESIZE)
+# endif
+# endif
+/* This is for older VMS. */
+# if !defined getpagesize && defined __VMS
+# ifdef __ALPHA
+# define getpagesize() 8192
+# else
+# define getpagesize() 512
+# endif
+# endif
+/* This is for BeOS. */
+# if !defined getpagesize && @HAVE_OS_H@
+# include <OS.h>
+# if defined B_PAGE_SIZE
+# define getpagesize() B_PAGE_SIZE
+# endif
+# endif
+/* This is for AmigaOS4.0. */
+# if !defined getpagesize && defined __amigaos4__
+# define getpagesize() 2048
+# endif
+/* This is for older Unix systems. */
+# if !defined getpagesize && @HAVE_SYS_PARAM_H@
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else
+# ifdef NBPG
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif
+# define getpagesize() (NBPG * CLSIZE)
+# else
+# ifdef NBPC
+# define getpagesize() NBPC
+# endif
+# endif
+# endif
+# endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getpagesize
+# define getpagesize() \
+ (GL_LINK_WARNING ("getpagesize is unportable - " \
+ "use gnulib module getpagesize for portability"), \
+ getpagesize ())
+#endif
+
+
#if @GNULIB_LCHOWN@
# if @REPLACE_LCHOWN@
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
diff --git a/gnulib/lib/unsetenv.c b/gnulib/lib/unsetenv.c
index 0f837440..90b84491 100644
--- a/gnulib/lib/unsetenv.c
+++ b/gnulib/lib/unsetenv.c
@@ -1,19 +1,18 @@
/* Copyright (C) 1992,1995-1999,2000-2002,2005-2006 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
+ 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 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/vasnprintf.c b/gnulib/lib/vasnprintf.c
index f5638233..4714ce93 100644
--- a/gnulib/lib/vasnprintf.c
+++ b/gnulib/lib/vasnprintf.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
@@ -88,27 +88,30 @@
/* Checked size_t computations. */
#include "xsize.h"
-#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
# include "float+.h"
-# include "fpucw.h"
#endif
-#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
# include "isnan.h"
#endif
-#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
# include "isnanl-nolibm.h"
# include "fpucw.h"
#endif
-#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
# include "isnan.h"
# include "printf-frexp.h"
+#endif
+
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
+# include <math.h>
# include "isnanl-nolibm.h"
# include "printf-frexpl.h"
# include "fpucw.h"
@@ -200,7 +203,7 @@ local_wcslen (const wchar_t *s)
/* Here we need to call the native sprintf, not rpl_sprintf. */
#undef sprintf
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
/* Determine the decimal-point character according to the current locale. */
# ifndef decimal_point_char_defined
# define decimal_point_char_defined 1
@@ -227,7 +230,7 @@ decimal_point_char ()
# endif
#endif
-#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL
+#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL
/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */
static int
@@ -238,7 +241,7 @@ is_infinite_or_zero (double x)
#endif
-#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL
+#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
/* Equivalent to !isfinite(x), but does not require libm. */
static int
@@ -249,7 +252,7 @@ is_infinitel (long double x)
#endif
-#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
/* Converting 'long double' to decimal without rare rounding bugs requires
real bignums. We use the naming conventions of GNU gmp, but vastly simpler
@@ -795,6 +798,8 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
return c_ptr;
}
+# if NEED_PRINTF_LONG_DOUBLE
+
/* Assuming x is finite and >= 0:
write x as x = 2^e * m, where m is a bignum.
Return the allocated memory in case of success, NULL in case of memory
@@ -823,8 +828,8 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
doesn't matter). */
-# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
-# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
+# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
+# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
{
mp_limb_t hi, lo;
y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2));
@@ -839,7 +844,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
abort ();
m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
}
-# else
+# else
{
mp_limb_t d;
y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS);
@@ -849,8 +854,8 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
abort ();
m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
}
+# endif
# endif
-# endif
for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
{
mp_limb_t hi, lo;
@@ -866,8 +871,11 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
abort ();
m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
}
+#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
+ precision. */
if (!(y == 0.0L))
abort ();
+#endif
/* Normalise. */
while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
m.nlimbs--;
@@ -876,17 +884,101 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
return m.limbs;
}
-/* Assuming x is finite and >= 0, and n is an integer:
+# endif
+
+# if NEED_PRINTF_DOUBLE
+
+/* Assuming x is finite and >= 0:
+ write x as x = 2^e * m, where m is a bignum.
+ Return the allocated memory in case of success, NULL in case of memory
+ allocation failure. */
+static void *
+decode_double (double x, int *ep, mpn_t *mp)
+{
+ mpn_t m;
+ int exp;
+ double y;
+ size_t i;
+
+ /* Allocate memory for result. */
+ m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+ m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
+ if (m.limbs == NULL)
+ return NULL;
+ /* Split into exponential part and mantissa. */
+ y = frexp (x, &exp);
+ if (!(y >= 0.0 && y < 1.0))
+ abort ();
+ /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the
+ latter is an integer. */
+ /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs.
+ I'm not sure whether it's safe to cast a 'double' value between
+ 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
+ 'double' values between 0 and 2^16 (to 'unsigned int' or 'int',
+ doesn't matter). */
+# if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0
+# if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
+ {
+ mp_limb_t hi, lo;
+ y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2));
+ hi = (int) y;
+ y -= hi;
+ if (!(y >= 0.0 && y < 1.0))
+ abort ();
+ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+ lo = (int) y;
+ y -= lo;
+ if (!(y >= 0.0 && y < 1.0))
+ abort ();
+ m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
+ }
+# else
+ {
+ mp_limb_t d;
+ y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS);
+ d = (int) y;
+ y -= d;
+ if (!(y >= 0.0 && y < 1.0))
+ abort ();
+ m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
+ }
+# endif
+# endif
+ for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
+ {
+ mp_limb_t hi, lo;
+ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+ hi = (int) y;
+ y -= hi;
+ if (!(y >= 0.0 && y < 1.0))
+ abort ();
+ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+ lo = (int) y;
+ y -= lo;
+ if (!(y >= 0.0 && y < 1.0))
+ abort ();
+ m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
+ }
+ if (!(y == 0.0))
+ abort ();
+ /* Normalise. */
+ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
+ m.nlimbs--;
+ *mp = m;
+ *ep = exp - DBL_MANT_BIT;
+ return m.limbs;
+}
+
+# endif
+
+/* Assuming x = 2^e * m is finite and >= 0, and n is an integer:
Returns the decimal representation of round (x * 10^n).
Return the allocated memory - containing the decimal digits in low-to-high
order, terminated with a NUL character - in case of success, NULL in case
of memory allocation failure. */
static char *
-scale10_round_decimal_long_double (long double x, int n)
+scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
{
- int e;
- mpn_t m;
- void *memory = decode_long_double (x, &e, &m);
int s;
size_t extra_zeroes;
unsigned int abs_n;
@@ -1066,7 +1158,7 @@ scale10_round_decimal_long_double (long double x, int n)
size_t count;
for (count = m.nlimbs; count > 0; count--)
{
- accu += (mp_twolimb_t) *sourceptr++ << s;
+ accu += (mp_twolimb_t) *sourceptr++ << s_bits;
*destptr++ = (mp_limb_t) accu;
accu = accu >> GMP_LIMB_BITS;
}
@@ -1099,6 +1191,44 @@ scale10_round_decimal_long_double (long double x, int n)
return digits;
}
+# if NEED_PRINTF_LONG_DOUBLE
+
+/* Assuming x is finite and >= 0, and n is an integer:
+ Returns the decimal representation of round (x * 10^n).
+ Return the allocated memory - containing the decimal digits in low-to-high
+ order, terminated with a NUL character - in case of success, NULL in case
+ of memory allocation failure. */
+static char *
+scale10_round_decimal_long_double (long double x, int n)
+{
+ int e;
+ mpn_t m;
+ void *memory = decode_long_double (x, &e, &m);
+ return scale10_round_decimal_decoded (e, m, memory, n);
+}
+
+# endif
+
+# if NEED_PRINTF_DOUBLE
+
+/* Assuming x is finite and >= 0, and n is an integer:
+ Returns the decimal representation of round (x * 10^n).
+ Return the allocated memory - containing the decimal digits in low-to-high
+ order, terminated with a NUL character - in case of success, NULL in case
+ of memory allocation failure. */
+static char *
+scale10_round_decimal_double (double x, int n)
+{
+ int e;
+ mpn_t m;
+ void *memory = decode_double (x, &e, &m);
+ return scale10_round_decimal_decoded (e, m, memory, n);
+}
+
+# endif
+
+# if NEED_PRINTF_LONG_DOUBLE
+
/* Assuming x is finite and > 0:
Return an approximation for n with 10^n <= x < 10^(n+1).
The approximation is usually the right n, but may be off by 1 sometimes. */
@@ -1186,6 +1316,99 @@ floorlog10l (long double x)
return (int) l + (l < 0 ? -1 : 0);
}
+# endif
+
+# if NEED_PRINTF_DOUBLE
+
+/* Assuming x is finite and > 0:
+ Return an approximation for n with 10^n <= x < 10^(n+1).
+ The approximation is usually the right n, but may be off by 1 sometimes. */
+static int
+floorlog10 (double x)
+{
+ int exp;
+ double y;
+ double z;
+ double l;
+
+ /* Split into exponential part and mantissa. */
+ y = frexp (x, &exp);
+ if (!(y >= 0.0 && y < 1.0))
+ abort ();
+ if (y == 0.0)
+ return INT_MIN;
+ if (y < 0.5)
+ {
+ while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
+ {
+ y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+ exp -= GMP_LIMB_BITS;
+ }
+ if (y < (1.0 / (1 << 16)))
+ {
+ y *= 1.0 * (1 << 16);
+ exp -= 16;
+ }
+ if (y < (1.0 / (1 << 8)))
+ {
+ y *= 1.0 * (1 << 8);
+ exp -= 8;
+ }
+ if (y < (1.0 / (1 << 4)))
+ {
+ y *= 1.0 * (1 << 4);
+ exp -= 4;
+ }
+ if (y < (1.0 / (1 << 2)))
+ {
+ y *= 1.0 * (1 << 2);
+ exp -= 2;
+ }
+ if (y < (1.0 / (1 << 1)))
+ {
+ y *= 1.0 * (1 << 1);
+ exp -= 1;
+ }
+ }
+ if (!(y >= 0.5 && y < 1.0))
+ abort ();
+ /* Compute an approximation for l = log2(x) = exp + log2(y). */
+ l = exp;
+ z = y;
+ if (z < 0.70710678118654752444)
+ {
+ z *= 1.4142135623730950488;
+ l -= 0.5;
+ }
+ if (z < 0.8408964152537145431)
+ {
+ z *= 1.1892071150027210667;
+ l -= 0.25;
+ }
+ if (z < 0.91700404320467123175)
+ {
+ z *= 1.0905077326652576592;
+ l -= 0.125;
+ }
+ if (z < 0.9576032806985736469)
+ {
+ z *= 1.0442737824274138403;
+ l -= 0.0625;
+ }
+ /* Now 0.95 <= z <= 1.01. */
+ z = 1 - z;
+ /* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ...
+ Four terms are enough to get an approximation with error < 10^-7. */
+ l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
+ /* Finally multiply with log(2)/log(10), yields an approximation for
+ log10(x). */
+ l *= 0.30102999566398119523;
+ /* Round down to the next integer. */
+ return (int) l + (l < 0 ? -1 : 0);
+}
+
+# endif
+
#endif
DCHAR_T *
@@ -1196,10 +1419,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
arguments a;
if (PRINTF_PARSE (format, &d, &a) < 0)
- {
- errno = EINVAL;
- return NULL;
- }
+ /* errno is already set. */
+ return NULL;
#define CLEANUP() \
free (d.dir); \
@@ -1819,8 +2040,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
#endif
-#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
- else if (dp->conversion == 'a' || dp->conversion == 'A')
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
+ else if ((dp->conversion == 'a' || dp->conversion == 'A')
+# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
+ && (0
+# if NEED_PRINTF_DOUBLE
+ || a.arg[dp->arg_index].type == TYPE_DOUBLE
+# endif
+# if NEED_PRINTF_LONG_DOUBLE
+ || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+# endif
+ )
+# endif
+ )
{
arg_type type = a.arg[dp->arg_index].type;
int flags = dp->flags;
@@ -1938,6 +2170,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
p = tmp;
if (type == TYPE_LONGDOUBLE)
{
+# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
long double arg = a.arg[dp->arg_index].a.a_longdouble;
if (isnanl (arg))
@@ -2057,7 +2290,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
*p++ = dp->conversion - 'A' + 'P';
-# if WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
{
static const wchar_t decimal_format[] =
{ '%', '+', 'd', '\0' };
@@ -2065,7 +2298,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
while (*p != '\0')
p++;
-# else
+# else
if (sizeof (DCHAR_T) == 1)
{
sprintf ((char *) p, "%+d", exponent);
@@ -2080,14 +2313,18 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
for (ep = expbuf; (*p = *ep) != '\0'; ep++)
p++;
}
-# endif
+# endif
}
END_LONG_DOUBLE_ROUNDING ();
}
+# else
+ abort ();
+# endif
}
else
{
+# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
double arg = a.arg[dp->arg_index].a.a_double;
if (isnan (arg))
@@ -2204,7 +2441,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
*p++ = dp->conversion - 'A' + 'P';
-# if WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
{
static const wchar_t decimal_format[] =
{ '%', '+', 'd', '\0' };
@@ -2212,7 +2449,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
while (*p != '\0')
p++;
-# else
+# else
if (sizeof (DCHAR_T) == 1)
{
sprintf ((char *) p, "%+d", exponent);
@@ -2227,9 +2464,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
for (ep = expbuf; (*p = *ep) != '\0'; ep++)
p++;
}
-# endif
+# endif
}
}
+# else
+ abort ();
+# endif
}
/* The generated string now extends from tmp to p, with the
zero padding insertion point being at pad_ptr. */
@@ -2292,13 +2532,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
#endif
-#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
+#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
else if ((dp->conversion == 'f' || dp->conversion == 'F'
|| dp->conversion == 'e' || dp->conversion == 'E'
|| dp->conversion == 'g' || dp->conversion == 'G'
|| dp->conversion == 'a' || dp->conversion == 'A')
&& (0
-# if NEED_PRINTF_INFINITE_DOUBLE
+# if NEED_PRINTF_DOUBLE
+ || a.arg[dp->arg_index].type == TYPE_DOUBLE
+# elif NEED_PRINTF_INFINITE_DOUBLE
|| (a.arg[dp->arg_index].type == TYPE_DOUBLE
/* The systems (mingw) which produce wrong output
for Inf, -Inf, and NaN also do so for -0.0.
@@ -2315,7 +2557,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
# endif
))
{
-# if NEED_PRINTF_INFINITE_DOUBLE && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
+# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
arg_type type = a.arg[dp->arg_index].type;
# endif
int flags = dp->flags;
@@ -2398,17 +2640,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
precision = 6;
/* Allocate a temporary buffer of sufficient size. */
-# if NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
+# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
+ tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
+# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
# elif NEED_PRINTF_LONG_DOUBLE
tmp_length = LDBL_DIG + 1;
+# elif NEED_PRINTF_DOUBLE
+ tmp_length = DBL_DIG + 1;
# else
tmp_length = 0;
# endif
if (tmp_length < precision)
tmp_length = precision;
# if NEED_PRINTF_LONG_DOUBLE
-# if NEED_PRINTF_INFINITE_DOUBLE
+# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
if (type == TYPE_LONGDOUBLE)
# endif
if (dp->conversion == 'f' || dp->conversion == 'F')
@@ -2423,6 +2669,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
# endif
+# if NEED_PRINTF_DOUBLE
+# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
+ if (type == TYPE_DOUBLE)
+# endif
+ if (dp->conversion == 'f' || dp->conversion == 'F')
+ {
+ double arg = a.arg[dp->arg_index].a.a_double;
+ if (!(isnan (arg) || arg + arg == arg))
+ {
+ /* arg is finite and nonzero. */
+ int exponent = floorlog10 (arg < 0 ? -arg : arg);
+ if (exponent >= 0 && tmp_length < exponent + precision)
+ tmp_length = exponent + precision;
+ }
+ }
+# endif
/* Account for sign, decimal point etc. */
tmp_length = xsum (tmp_length, 12);
@@ -2450,7 +2712,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
p = tmp;
# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
-# if NEED_PRINTF_INFINITE_DOUBLE
+# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
if (type == TYPE_LONGDOUBLE)
# endif
{
@@ -2810,13 +3072,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
END_LONG_DOUBLE_ROUNDING ();
}
}
-# if NEED_PRINTF_INFINITE_DOUBLE
+# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
else
# endif
# endif
-# if NEED_PRINTF_INFINITE_DOUBLE
+# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
{
- /* Simpler than above: handle only NaN, Infinity, zero. */
double arg = a.arg[dp->arg_index].a.a_double;
if (isnan (arg))
@@ -2834,7 +3095,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
int sign = 0;
- if (signbit (arg)) /* arg < 0.0L or negative zero */
+ if (signbit (arg)) /* arg < 0.0 or negative zero */
{
sign = -1;
arg = -arg;
@@ -2860,6 +3121,332 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
else
{
+# if NEED_PRINTF_DOUBLE
+ pad_ptr = p;
+
+ if (dp->conversion == 'f' || dp->conversion == 'F')
+ {
+ char *digits;
+ size_t ndigits;
+
+ digits =
+ scale10_round_decimal_double (arg, precision);
+ if (digits == NULL)
+ goto out_of_memory;
+ ndigits = strlen (digits);
+
+ if (ndigits > precision)
+ do
+ {
+ --ndigits;
+ *p++ = digits[ndigits];
+ }
+ while (ndigits > precision);
+ else
+ *p++ = '0';
+ /* Here ndigits <= precision. */
+ if ((flags & FLAG_ALT) || precision > 0)
+ {
+ *p++ = decimal_point_char ();
+ for (; precision > ndigits; precision--)
+ *p++ = '0';
+ while (ndigits > 0)
+ {
+ --ndigits;
+ *p++ = digits[ndigits];
+ }
+ }
+
+ free (digits);
+ }
+ else if (dp->conversion == 'e' || dp->conversion == 'E')
+ {
+ int exponent;
+
+ if (arg == 0.0)
+ {
+ exponent = 0;
+ *p++ = '0';
+ if ((flags & FLAG_ALT) || precision > 0)
+ {
+ *p++ = decimal_point_char ();
+ for (; precision > 0; precision--)
+ *p++ = '0';
+ }
+ }
+ else
+ {
+ /* arg > 0.0. */
+ int adjusted;
+ char *digits;
+ size_t ndigits;
+
+ exponent = floorlog10 (arg);
+ adjusted = 0;
+ for (;;)
+ {
+ digits =
+ scale10_round_decimal_double (arg,
+ (int)precision - exponent);
+ if (digits == NULL)
+ goto out_of_memory;
+ ndigits = strlen (digits);
+
+ if (ndigits == precision + 1)
+ break;
+ if (ndigits < precision
+ || ndigits > precision + 2)
+ /* The exponent was not guessed
+ precisely enough. */
+ abort ();
+ if (adjusted)
+ /* None of two values of exponent is
+ the right one. Prevent an endless
+ loop. */
+ abort ();
+ free (digits);
+ if (ndigits == precision)
+ exponent -= 1;
+ else
+ exponent += 1;
+ adjusted = 1;
+ }
+
+ /* Here ndigits = precision+1. */
+ *p++ = digits[--ndigits];
+ if ((flags & FLAG_ALT) || precision > 0)
+ {
+ *p++ = decimal_point_char ();
+ while (ndigits > 0)
+ {
+ --ndigits;
+ *p++ = digits[ndigits];
+ }
+ }
+
+ free (digits);
+ }
+
+ *p++ = dp->conversion; /* 'e' or 'E' */
+# if WIDE_CHAR_VERSION
+ {
+ static const wchar_t decimal_format[] =
+ /* Produce the same number of exponent digits
+ as the native printf implementation. */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ { '%', '+', '.', '3', 'd', '\0' };
+# else
+ { '%', '+', '.', '2', 'd', '\0' };
+# endif
+ SNPRINTF (p, 6 + 1, decimal_format, exponent);
+ }
+ while (*p != '\0')
+ p++;
+# else
+ {
+ static const char decimal_format[] =
+ /* Produce the same number of exponent digits
+ as the native printf implementation. */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ "%+.3d";
+# else
+ "%+.2d";
+# endif
+ if (sizeof (DCHAR_T) == 1)
+ {
+ sprintf ((char *) p, decimal_format, exponent);
+ while (*p != '\0')
+ p++;
+ }
+ else
+ {
+ char expbuf[6 + 1];
+ const char *ep;
+ sprintf (expbuf, decimal_format, exponent);
+ for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+ p++;
+ }
+ }
+# endif
+ }
+ else if (dp->conversion == 'g' || dp->conversion == 'G')
+ {
+ if (precision == 0)
+ precision = 1;
+ /* precision >= 1. */
+
+ if (arg == 0.0)
+ /* The exponent is 0, >= -4, < precision.
+ Use fixed-point notation. */
+ {
+ size_t ndigits = precision;
+ /* Number of trailing zeroes that have to be
+ dropped. */
+ size_t nzeroes =
+ (flags & FLAG_ALT ? 0 : precision - 1);
+
+ --ndigits;
+ *p++ = '0';
+ if ((flags & FLAG_ALT) || ndigits > nzeroes)
+ {
+ *p++ = decimal_point_char ();
+ while (ndigits > nzeroes)
+ {
+ --ndigits;
+ *p++ = '0';
+ }
+ }
+ }
+ else
+ {
+ /* arg > 0.0. */
+ int exponent;
+ int adjusted;
+ char *digits;
+ size_t ndigits;
+ size_t nzeroes;
+
+ exponent = floorlog10 (arg);
+ adjusted = 0;
+ for (;;)
+ {
+ digits =
+ scale10_round_decimal_double (arg,
+ (int)(precision - 1) - exponent);
+ if (digits == NULL)
+ goto out_of_memory;
+ ndigits = strlen (digits);
+
+ if (ndigits == precision)
+ break;
+ if (ndigits < precision - 1
+ || ndigits > precision + 1)
+ /* The exponent was not guessed
+ precisely enough. */
+ abort ();
+ if (adjusted)
+ /* None of two values of exponent is
+ the right one. Prevent an endless
+ loop. */
+ abort ();
+ free (digits);
+ if (ndigits < precision)
+ exponent -= 1;
+ else
+ exponent += 1;
+ adjusted = 1;
+ }
+ /* Here ndigits = precision. */
+
+ /* Determine the number of trailing zeroes
+ that have to be dropped. */
+ nzeroes = 0;
+ if ((flags & FLAG_ALT) == 0)
+ while (nzeroes < ndigits
+ && digits[nzeroes] == '0')
+ nzeroes++;
+
+ /* The exponent is now determined. */
+ if (exponent >= -4
+ && exponent < (long)precision)
+ {
+ /* Fixed-point notation:
+ max(exponent,0)+1 digits, then the
+ decimal point, then the remaining
+ digits without trailing zeroes. */
+ if (exponent >= 0)
+ {
+ size_t count = exponent + 1;
+ /* Note: count <= precision = ndigits. */
+ for (; count > 0; count--)
+ *p++ = digits[--ndigits];
+ if ((flags & FLAG_ALT) || ndigits > nzeroes)
+ {
+ *p++ = decimal_point_char ();
+ while (ndigits > nzeroes)
+ {
+ --ndigits;
+ *p++ = digits[ndigits];
+ }
+ }
+ }
+ else
+ {
+ size_t count = -exponent - 1;
+ *p++ = '0';
+ *p++ = decimal_point_char ();
+ for (; count > 0; count--)
+ *p++ = '0';
+ while (ndigits > nzeroes)
+ {
+ --ndigits;
+ *p++ = digits[ndigits];
+ }
+ }
+ }
+ else
+ {
+ /* Exponential notation. */
+ *p++ = digits[--ndigits];
+ if ((flags & FLAG_ALT) || ndigits > nzeroes)
+ {
+ *p++ = decimal_point_char ();
+ while (ndigits > nzeroes)
+ {
+ --ndigits;
+ *p++ = digits[ndigits];
+ }
+ }
+ *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
+# if WIDE_CHAR_VERSION
+ {
+ static const wchar_t decimal_format[] =
+ /* Produce the same number of exponent digits
+ as the native printf implementation. */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ { '%', '+', '.', '3', 'd', '\0' };
+# else
+ { '%', '+', '.', '2', 'd', '\0' };
+# endif
+ SNPRINTF (p, 6 + 1, decimal_format, exponent);
+ }
+ while (*p != '\0')
+ p++;
+# else
+ {
+ static const char decimal_format[] =
+ /* Produce the same number of exponent digits
+ as the native printf implementation. */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ "%+.3d";
+# else
+ "%+.2d";
+# endif
+ if (sizeof (DCHAR_T) == 1)
+ {
+ sprintf ((char *) p, decimal_format, exponent);
+ while (*p != '\0')
+ p++;
+ }
+ else
+ {
+ char expbuf[6 + 1];
+ const char *ep;
+ sprintf (expbuf, decimal_format, exponent);
+ for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+ p++;
+ }
+ }
+# endif
+ }
+
+ free (digits);
+ }
+ }
+ else
+ abort ();
+# else
+ /* arg is finite. */
if (!(arg == 0.0))
abort ();
@@ -2888,9 +3475,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
*p++ = '+';
/* Produce the same number of exponent digits as
the native printf implementation. */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
*p++ = '0';
-# endif
+# endif
*p++ = '0';
*p++ = '0';
}
@@ -2908,6 +3495,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
else
abort ();
+# endif
}
}
}
@@ -2978,11 +3566,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
arg_type type = a.arg[dp->arg_index].type;
int flags = dp->flags;
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
int has_width;
size_t width;
#endif
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
+ int has_precision;
+ size_t precision;
+#endif
+#if NEED_PRINTF_UNBOUNDED_PRECISION
+ int prec_ourselves;
+#else
+# define prec_ourselves 0
+#endif
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
int pad_ourselves;
#else
# define pad_ourselves 0
@@ -2996,7 +3593,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
TCHAR_T *tmp;
#endif
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
has_width = 0;
width = 0;
if (dp->width_start != dp->width_end)
@@ -3030,34 +3627,42 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
#endif
+#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
+ has_precision = 0;
+ precision = 6;
+ if (dp->precision_start != dp->precision_end)
+ {
+ if (dp->precision_arg_index != ARG_NONE)
+ {
+ int arg;
+
+ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+ abort ();
+ arg = a.arg[dp->precision_arg_index].a.a_int;
+ /* "A negative precision is taken as if the precision
+ were omitted." */
+ if (arg >= 0)
+ {
+ precision = arg;
+ has_precision = 1;
+ }
+ }
+ else
+ {
+ const FCHAR_T *digitp = dp->precision_start + 1;
+
+ precision = 0;
+ while (digitp != dp->precision_end)
+ precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+ has_precision = 1;
+ }
+ }
+#endif
+
#if !USE_SNPRINTF
/* Allocate a temporary buffer of sufficient size for calling
sprintf. */
{
- size_t precision;
-
- precision = 6;
- if (dp->precision_start != dp->precision_end)
- {
- if (dp->precision_arg_index != ARG_NONE)
- {
- int arg;
-
- if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
- abort ();
- arg = a.arg[dp->precision_arg_index].a.a_int;
- precision = (arg < 0 ? 0 : arg);
- }
- else
- {
- const FCHAR_T *digitp = dp->precision_start + 1;
-
- precision = 0;
- while (digitp != dp->precision_end)
- precision = xsum (xtimes (precision, 10), *digitp++ - '0');
- }
- }
-
switch (dp->conversion)
{
@@ -3262,8 +3867,23 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
#endif
+ /* Decide whether to handle the precision ourselves. */
+#if NEED_PRINTF_UNBOUNDED_PRECISION
+ switch (dp->conversion)
+ {
+ case 'd': case 'i': case 'u':
+ case 'o':
+ case 'x': case 'X': case 'p':
+ prec_ourselves = has_precision && (precision > 0);
+ break;
+ default:
+ prec_ourselves = 0;
+ break;
+ }
+#endif
+
/* Decide whether to perform the padding ourselves. */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
switch (dp->conversion)
{
# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
@@ -3280,7 +3900,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
pad_ourselves = 1;
break;
default:
- pad_ourselves = 0;
+ pad_ourselves = prec_ourselves;
break;
}
#endif
@@ -3328,22 +3948,25 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
}
- if (dp->precision_start != dp->precision_end)
+ if (!prec_ourselves)
{
- size_t n = dp->precision_end - dp->precision_start;
- /* The precision specification is known to consist only
- of standard ASCII characters. */
- if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+ if (dp->precision_start != dp->precision_end)
{
- memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
- fbp += n;
- }
- else
- {
- const FCHAR_T *mp = dp->precision_start;
- do
- *fbp++ = (unsigned char) *mp++;
- while (--n > 0);
+ size_t n = dp->precision_end - dp->precision_start;
+ /* The precision specification is known to consist only
+ of standard ASCII characters. */
+ if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+ {
+ memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
+ fbp += n;
+ }
+ else
+ {
+ const FCHAR_T *mp = dp->precision_start;
+ do
+ *fbp++ = (unsigned char) *mp++;
+ while (--n > 0);
+ }
}
}
@@ -3385,9 +4008,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif
*fbp = dp->conversion;
#if USE_SNPRINTF
+# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))
fbp[1] = '%';
fbp[2] = 'n';
fbp[3] = '\0';
+# else
+ /* On glibc2 systems from glibc >= 2.3 - probably also older
+ ones - we know that snprintf's returns value conforms to
+ ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
+ Therefore we can avoid using %n in this situation.
+ On glibc2 systems from 2004-10-18 or newer, the use of %n
+ in format strings in writable memory may crash the program
+ (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
+ in this situation. */
+ fbp[1] = '\0';
+# endif
#else
fbp[1] = '\0';
#endif
@@ -3414,9 +4049,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
alignof (TCHAR_T) <= alignof (DCHAR_T). */
# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
+ /* Ensure that maxlen below will be >= 2. Needed on BeOS,
+ where an snprintf() with maxlen==1 acts like sprintf(). */
+ ENSURE_ALLOCATION (xsum (length,
+ (2 + TCHARS_PER_DCHAR - 1)
+ / TCHARS_PER_DCHAR));
/* Prepare checking whether snprintf returns the count
via %n. */
- ENSURE_ALLOCATION (xsum (length, 1));
*(TCHAR_T *) (result + length) = '\0';
#endif
@@ -3430,7 +4069,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* SNPRINTF can fail if its second argument is
> INT_MAX. */
if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
- goto overflow;
+ maxlen = INT_MAX / TCHARS_PER_DCHAR;
maxlen = maxlen * TCHARS_PER_DCHAR;
# define SNPRINTF_BUF(arg) \
switch (prefix_count) \
@@ -3648,20 +4287,102 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
#if USE_SNPRINTF
- /* Handle overflow of the allocated buffer. */
- if (count >= maxlen)
+ /* Handle overflow of the allocated buffer.
+ If such an overflow occurs, a C99 compliant snprintf()
+ returns a count >= maxlen. However, a non-compliant
+ snprintf() function returns only count = maxlen - 1. To
+ cover both cases, test whether count >= maxlen - 1. */
+ if ((unsigned int) count + 1 >= maxlen)
{
- /* Need at least count * sizeof (TCHAR_T) bytes. But
- allocate proportionally, to avoid looping eternally
- if snprintf() reports a too small count. */
- size_t n =
- xmax (xsum (length,
- (count + TCHARS_PER_DCHAR - 1)
- / TCHARS_PER_DCHAR),
- xtimes (allocated, 2));
+ /* If maxlen already has attained its allowed maximum,
+ allocating more memory will not increase maxlen.
+ Instead of looping, bail out. */
+ if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
+ goto overflow;
+ else
+ {
+ /* Need at least (count + 1) * sizeof (TCHAR_T)
+ bytes. (The +1 is for the trailing NUL.)
+ But ask for (count + 2) * sizeof (TCHAR_T)
+ bytes, so that in the next round, we likely get
+ maxlen > (unsigned int) count + 1
+ and so we don't get here again.
+ And allocate proportionally, to avoid looping
+ eternally if snprintf() reports a too small
+ count. */
+ size_t n =
+ xmax (xsum (length,
+ ((unsigned int) count + 2
+ + TCHARS_PER_DCHAR - 1)
+ / TCHARS_PER_DCHAR),
+ xtimes (allocated, 2));
+
+ ENSURE_ALLOCATION (n);
+ continue;
+ }
+ }
+#endif
- ENSURE_ALLOCATION (n);
- continue;
+#if NEED_PRINTF_UNBOUNDED_PRECISION
+ if (prec_ourselves)
+ {
+ /* Handle the precision. */
+ TCHAR_T *prec_ptr =
+# if USE_SNPRINTF
+ (TCHAR_T *) (result + length);
+# else
+ tmp;
+# endif
+ size_t prefix_count;
+ size_t move;
+
+ prefix_count = 0;
+ /* Put the additional zeroes after the sign. */
+ if (count >= 1
+ && (*prec_ptr == '-' || *prec_ptr == '+'
+ || *prec_ptr == ' '))
+ prefix_count = 1;
+ /* Put the additional zeroes after the 0x prefix if
+ (flags & FLAG_ALT) || (dp->conversion == 'p'). */
+ else if (count >= 2
+ && prec_ptr[0] == '0'
+ && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
+ prefix_count = 2;
+
+ move = count - prefix_count;
+ if (precision > move)
+ {
+ /* Insert zeroes. */
+ size_t insert = precision - move;
+ TCHAR_T *prec_end;
+
+# if USE_SNPRINTF
+ size_t n =
+ xsum (length,
+ (count + insert + TCHARS_PER_DCHAR - 1)
+ / TCHARS_PER_DCHAR);
+ length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+ ENSURE_ALLOCATION (n);
+ length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+ prec_ptr = (TCHAR_T *) (result + length);
+# endif
+
+ prec_end = prec_ptr + count;
+ prec_ptr += prefix_count;
+
+ while (prec_end > prec_ptr)
+ {
+ prec_end--;
+ prec_end[insert] = prec_end[0];
+ }
+
+ prec_end += insert;
+ do
+ *--prec_end = '0';
+ while (prec_end > prec_ptr);
+
+ count += insert;
+ }
}
#endif
@@ -3773,7 +4494,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* Here count <= allocated - length. */
/* Perform padding. */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
if (pad_ourselves && has_width)
{
size_t w;
@@ -3957,9 +4678,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#undef TCHARS_PER_DCHAR
#undef SNPRINTF
#undef USE_SNPRINTF
+#undef DCHAR_CPY
#undef PRINTF_PARSE
#undef DIRECTIVES
#undef DIRECTIVE
+#undef DCHAR_IS_TCHAR
#undef TCHAR_T
#undef DCHAR_T
#undef FCHAR_T
diff --git a/gnulib/lib/vasnprintf.h b/gnulib/lib/vasnprintf.h
index 7a0c01f4..81b72f68 100644
--- a/gnulib/lib/vasnprintf.h
+++ b/gnulib/lib/vasnprintf.h
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/vasprintf.c b/gnulib/lib/vasprintf.c
index db365e0a..90f64e91 100644
--- a/gnulib/lib/vasprintf.c
+++ b/gnulib/lib/vasprintf.c
@@ -3,7 +3,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/vsnprintf.c b/gnulib/lib/vsnprintf.c
index 4f841fc4..cc8f61f1 100644
--- a/gnulib/lib/vsnprintf.c
+++ b/gnulib/lib/vsnprintf.c
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/wchar_.h b/gnulib/lib/wchar.in.h
index 924a3382..b721572e 100644
--- a/gnulib/lib/wchar_.h
+++ b/gnulib/lib/wchar.in.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/wctype_.h b/gnulib/lib/wctype.in.h
index 73ce09f4..a86b5ad4 100644
--- a/gnulib/lib/wctype_.h
+++ b/gnulib/lib/wctype.in.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/xalloc-die.c b/gnulib/lib/xalloc-die.c
index 090f060d..0a0694fc 100644
--- a/gnulib/lib/xalloc-die.c
+++ b/gnulib/lib/xalloc-die.c
@@ -3,10 +3,10 @@
Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free
Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -14,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/xalloc.h b/gnulib/lib/xalloc.h
index 0c6d8dcf..9c40d726 100644
--- a/gnulib/lib/xalloc.h
+++ b/gnulib/lib/xalloc.h
@@ -3,10 +3,10 @@
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -14,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef XALLOC_H_
# define XALLOC_H_
diff --git a/gnulib/lib/xasprintf.c b/gnulib/lib/xasprintf.c
index cf1b8a5e..5b4f0c0b 100644
--- a/gnulib/lib/xasprintf.c
+++ b/gnulib/lib/xasprintf.c
@@ -1,19 +1,18 @@
/* vasprintf and asprintf with out-of-memory checking.
Copyright (C) 1999, 2002-2004, 2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/xgetcwd.c b/gnulib/lib/xgetcwd.c
index 26ea5da5..6787b465 100644
--- a/gnulib/lib/xgetcwd.c
+++ b/gnulib/lib/xgetcwd.c
@@ -2,10 +2,10 @@
Copyright (C) 2001, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */
diff --git a/gnulib/lib/xgetcwd.h b/gnulib/lib/xgetcwd.h
index 70afe35e..3d966de9 100644
--- a/gnulib/lib/xgetcwd.h
+++ b/gnulib/lib/xgetcwd.h
@@ -1,10 +1,10 @@
/* prototype for xgetcwd
Copyright (C) 1995, 2001, 2003 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -12,7 +12,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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
extern char *xgetcwd (void);
diff --git a/gnulib/lib/xmalloc.c b/gnulib/lib/xmalloc.c
index b5aaf76e..e049ff8f 100644
--- a/gnulib/lib/xmalloc.c
+++ b/gnulib/lib/xmalloc.c
@@ -4,10 +4,10 @@
1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -15,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/xmalloc.c.orig b/gnulib/lib/xmalloc.c.orig
new file mode 100644
index 00000000..3a123457
--- /dev/null
+++ b/gnulib/lib/xmalloc.c.orig
@@ -0,0 +1,122 @@
+/* xmalloc.c -- malloc with out of memory checking
+
+ Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2002, 2003, 2004, 2005, 2006 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 <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#if ! HAVE_INLINE
+# define static_inline
+#endif
+#include "xalloc.h"
+#undef static_inline
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
+/* 1 if calloc is known to be compatible with GNU calloc. This
+ matters if we are not also using the calloc module, which defines
+ HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */
+#if defined HAVE_CALLOC || defined __GLIBC__
+enum { HAVE_GNU_CALLOC = 1 };
+#else
+enum { HAVE_GNU_CALLOC = 0 };
+#endif
+
+/* Allocate N bytes of memory dynamically, with error checking. */
+
+void *
+xmalloc (size_t n)
+{
+ void *p = malloc (n);
+ if (!p && n != 0)
+ xalloc_die ();
+ return p;
+}
+
+/* Change the size of an allocated block of memory P to N bytes,
+ with error checking. */
+
+void *
+xrealloc (void *p, size_t n)
+{
+ p = realloc (p, n);
+ if (!p && n != 0)
+ xalloc_die ();
+ return p;
+}
+
+/* If P is null, allocate a block of at least *PN bytes; otherwise,
+ reallocate P so that it contains more than *PN bytes. *PN must be
+ nonzero unless P is null. Set *PN to the new block's size, and
+ return the pointer to the new block. *PN is never set to zero, and
+ the returned pointer is never null. */
+
+void *
+x2realloc (void *p, size_t *pn)
+{
+ return x2nrealloc (p, pn, 1);
+}
+
+/* Allocate S bytes of zeroed memory dynamically, with error checking.
+ There's no need for xnzalloc (N, S), since it would be equivalent
+ to xcalloc (N, S). */
+
+void *
+xzalloc (size_t s)
+{
+ return memset (xmalloc (s), 0, s);
+}
+
+/* Allocate zeroed memory for N elements of S bytes, with error
+ checking. S must be nonzero. */
+
+void *
+xcalloc (size_t n, size_t s)
+{
+ void *p;
+ /* Test for overflow, since some calloc implementations don't have
+ proper overflow checks. But omit overflow and size-zero tests if
+ HAVE_GNU_CALLOC, since GNU calloc catches overflow and never
+ returns NULL if successful. */
+ if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s))
+ || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0)))
+ xalloc_die ();
+ return p;
+}
+
+/* Clone an object P of size S, with error checking. There's no need
+ for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
+ need for an arithmetic overflow check. */
+
+void *
+xmemdup (void const *p, size_t s)
+{
+ return memcpy (xmalloc (s), p, s);
+}
+
+/* Clone STRING. */
+
+char *
+xstrdup (char const *string)
+{
+ return xmemdup (string, strlen (string) + 1);
+}
diff --git a/gnulib/lib/xsize.h b/gnulib/lib/xsize.h
index 341fb16c..b294d66a 100644
--- a/gnulib/lib/xsize.h
+++ b/gnulib/lib/xsize.h
@@ -4,7 +4,7 @@
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 2, or (at your option)
+ 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,
diff --git a/gnulib/lib/xstrndup.c b/gnulib/lib/xstrndup.c
index 7ccefd79..37488cd9 100644
--- a/gnulib/lib/xstrndup.c
+++ b/gnulib/lib/xstrndup.c
@@ -2,10 +2,10 @@
checking.
Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/xstrndup.h b/gnulib/lib/xstrndup.h
index 88354cfd..4882e394 100644
--- a/gnulib/lib/xstrndup.h
+++ b/gnulib/lib/xstrndup.h
@@ -2,10 +2,10 @@
checking.
Copyright (C) 2003 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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
@@ -13,8 +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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stddef.h>
diff --git a/gnulib/lib/xvasprintf.c b/gnulib/lib/xvasprintf.c
index bd683627..26828a1a 100644
--- a/gnulib/lib/xvasprintf.c
+++ b/gnulib/lib/xvasprintf.c
@@ -1,19 +1,18 @@
/* vasprintf and asprintf with out-of-memory checking.
Copyright (C) 1999, 2002-2004, 2006, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/gnulib/lib/xvasprintf.h b/gnulib/lib/xvasprintf.h
index 70c6230d..b3712512 100644
--- a/gnulib/lib/xvasprintf.h
+++ b/gnulib/lib/xvasprintf.h
@@ -1,19 +1,18 @@
/* vasprintf and asprintf with out-of-memory checking.
Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _XVASPRINTF_H
#define _XVASPRINTF_H
diff --git a/gnulib/m4/canonicalize-lgpl.m4 b/gnulib/m4/canonicalize-lgpl.m4
new file mode 100644
index 00000000..b0a79025
--- /dev/null
+++ b/gnulib/m4/canonicalize-lgpl.m4
@@ -0,0 +1,35 @@
+# canonicalize-lgpl.m4 serial 4
+dnl Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_CANONICALIZE_LGPL],
+[
+ dnl Do this replacement check manually because the file name is shorter
+ dnl than the function name.
+ AC_CHECK_DECLS_ONCE(canonicalize_file_name)
+ AC_CHECK_FUNCS_ONCE(canonicalize_file_name)
+ if test $ac_cv_func_canonicalize_file_name = no; then
+ AC_LIBOBJ(canonicalize-lgpl)
+ AC_DEFINE([realpath], [rpl_realpath],
+ [Define to a replacement function name for realpath().])
+ gl_PREREQ_CANONICALIZE_LGPL
+ fi
+])
+
+# Like gl_CANONICALIZE_LGPL, except prepare for separate compilation
+# (no AC_LIBOBJ).
+AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
+[
+ AC_CHECK_DECLS_ONCE(canonicalize_file_name)
+ AC_CHECK_FUNCS_ONCE(canonicalize_file_name)
+ gl_PREREQ_CANONICALIZE_LGPL
+])
+
+# Prerequisites of lib/canonicalize-lgpl.c.
+AC_DEFUN([gl_PREREQ_CANONICALIZE_LGPL],
+[
+ AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h)
+ AC_CHECK_FUNCS_ONCE(getcwd readlink)
+])
diff --git a/gnulib/m4/chdir-long.m4 b/gnulib/m4/chdir-long.m4
new file mode 100644
index 00000000..7f34f60c
--- /dev/null
+++ b/gnulib/m4/chdir-long.m4
@@ -0,0 +1,38 @@
+#serial 10
+
+# Use Gnulib's robust chdir function.
+# It can handle arbitrarily long directory names, which means
+# that when it is given the name of an existing directory, it
+# never fails with ENAMETOOLONG.
+# Arrange to compile chdir-long.c only on systems that define PATH_MAX.
+
+dnl Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_CHDIR_LONG],
+[
+ AC_CACHE_CHECK([whether this system has an arbitrary file name length limit],
+ gl_cv_have_arbitrary_file_name_length_limit,
+ [AC_EGREP_CPP([have_arbitrary_file_name_length_limit],
+ [#include <unistd.h>
+#include <limits.h>
+#if defined PATH_MAX || defined MAXPATHLEN
+have_arbitrary_file_name_length_limit
+#endif],
+ gl_cv_have_arbitrary_file_name_length_limit=yes,
+ gl_cv_have_arbitrary_file_name_length_limit=no)])
+
+ if test $gl_cv_have_arbitrary_file_name_length_limit = yes; then
+ AC_LIBOBJ([chdir-long])
+ gl_PREREQ_CHDIR_LONG
+ fi
+])
+
+AC_DEFUN([gl_PREREQ_CHDIR_LONG],
+[
+ :
+])
diff --git a/gnulib/m4/chown.m4 b/gnulib/m4/chown.m4
new file mode 100644
index 00000000..89761f5f
--- /dev/null
+++ b/gnulib/m4/chown.m4
@@ -0,0 +1,83 @@
+#serial 17
+# Determine whether we need the chown wrapper.
+
+dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007 Free
+dnl Software Foundation, Inc.
+
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# chown should accept arguments of -1 for uid and gid, and it should
+# dereference symlinks. If it doesn't, arrange to use the replacement
+# function.
+
+# From Jim Meyering.
+
+AC_DEFUN([gl_FUNC_CHOWN],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([AC_TYPE_UID_T])
+ AC_REQUIRE([AC_FUNC_CHOWN])
+ AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK])
+
+ if test $ac_cv_func_chown_works = no; then
+ AC_DEFINE(CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE, 1,
+ [Define if chown is not POSIX compliant regarding IDs of -1.])
+ fi
+
+ # If chown has either of the above problems, then we need the wrapper.
+ if test $ac_cv_func_chown_works$gl_cv_func_chown_follows_symlink = yesyes; then
+ : # no wrapper needed
+ else
+ REPLACE_CHOWN=1
+ AC_LIBOBJ(chown)
+ gl_PREREQ_CHOWN
+ fi
+])
+
+# Determine whether chown follows symlinks (it should).
+AC_DEFUN([gl_FUNC_CHOWN_FOLLOWS_SYMLINK],
+[
+ AC_CACHE_CHECK(
+ [whether chown(2) dereferences symlinks],
+ gl_cv_func_chown_follows_symlink,
+ [
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
+ int
+ main ()
+ {
+ char const *dangling_symlink = "conftest.dangle";
+
+ unlink (dangling_symlink);
+ if (symlink ("conftest.no-such", dangling_symlink))
+ abort ();
+
+ /* Exit successfully on a conforming system,
+ i.e., where chown must fail with ENOENT. */
+ exit ( ! (chown (dangling_symlink, getuid (), getgid ()) != 0
+ && errno == ENOENT));
+ }
+ ]])],
+ [gl_cv_func_chown_follows_symlink=yes],
+ [gl_cv_func_chown_follows_symlink=no],
+ [gl_cv_func_chown_follows_symlink=yes]
+ )
+ ]
+ )
+
+ if test $gl_cv_func_chown_follows_symlink = no; then
+ AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1,
+ [Define if chown modifies symlinks.])
+ fi
+])
+
+# Prerequisites of lib/chown.c.
+AC_DEFUN([gl_PREREQ_CHOWN],
+[
+ AC_CHECK_FUNC([fchown], , [AC_LIBOBJ(fchown-stub)])
+])
diff --git a/gnulib/m4/d-type.m4 b/gnulib/m4/d-type.m4
index 7675dd2b..92f9b158 100644
--- a/gnulib/m4/d-type.m4
+++ b/gnulib/m4/d-type.m4
@@ -14,7 +14,7 @@ dnl
AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
[AC_CACHE_CHECK([for d_type member in directory struct],
- jm_cv_struct_dirent_d_type,
+ gl_cv_struct_dirent_d_type,
[AC_TRY_LINK(dnl
[
#include <sys/types.h>
@@ -22,11 +22,11 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
],
[struct dirent dp; dp.d_type = 0;],
- jm_cv_struct_dirent_d_type=yes,
- jm_cv_struct_dirent_d_type=no)
+ gl_cv_struct_dirent_d_type=yes,
+ gl_cv_struct_dirent_d_type=no)
]
)
- if test $jm_cv_struct_dirent_d_type = yes; then
+ if test $gl_cv_struct_dirent_d_type = yes; then
AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
[Define if there is a member named d_type in the struct describing
directory headers.])
diff --git a/gnulib/m4/dup2.m4 b/gnulib/m4/dup2.m4
new file mode 100644
index 00000000..05498235
--- /dev/null
+++ b/gnulib/m4/dup2.m4
@@ -0,0 +1,15 @@
+#serial 5
+dnl Copyright (C) 2002, 2005, 2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_DUP2],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([dup2])
+ if test $ac_cv_func_dup2 = no; then
+ HAVE_DUP2=0
+ AC_LIBOBJ([dup2])
+ fi
+])
diff --git a/gnulib/m4/fchdir.m4 b/gnulib/m4/fchdir.m4
new file mode 100644
index 00000000..fd170d29
--- /dev/null
+++ b/gnulib/m4/fchdir.m4
@@ -0,0 +1,26 @@
+# fchdir.m4 serial 4
+dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_FCHDIR],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([fchdir])
+ if test $ac_cv_func_fchdir = no; then
+ REPLACE_FCHDIR=1
+ AC_LIBOBJ([fchdir])
+ gl_PREREQ_FCHDIR
+ AC_DEFINE([FCHDIR_REPLACEMENT], 1,
+ [Define if gnulib's fchdir() replacement is used.])
+ gl_CHECK_NEXT_HEADERS([dirent.h])
+ DIRENT_H='dirent.h'
+ else
+ DIRENT_H=
+ fi
+ AC_SUBST([DIRENT_H])
+])
+
+# Prerequisites of lib/fchdir.c.
+AC_DEFUN([gl_PREREQ_FCHDIR], [:])
diff --git a/gnulib/m4/cycle-check.m4 b/gnulib/m4/fcntl-safer.m4
index 608f781a..3475b0a7 100644
--- a/gnulib/m4/cycle-check.m4
+++ b/gnulib/m4/fcntl-safer.m4
@@ -1,11 +1,11 @@
#serial 5
-dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_CYCLE_CHECK],
+AC_DEFUN([gl_FCNTL_SAFER],
[
- AC_REQUIRE([AC_C_INLINE])
- AC_LIBOBJ([cycle-check])
+ AC_LIBOBJ([open-safer])
+ AC_LIBOBJ([creat-safer])
])
diff --git a/gnulib/m4/fcntl_h.m4 b/gnulib/m4/fcntl_h.m4
new file mode 100644
index 00000000..e3b9aa52
--- /dev/null
+++ b/gnulib/m4/fcntl_h.m4
@@ -0,0 +1,94 @@
+# Configure fcntl.h.
+dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Paul Eggert.
+
+AC_DEFUN([gl_FCNTL_H],
+[
+ AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+ AC_CACHE_CHECK([for working fcntl.h], gl_cv_header_working_fcntl_h,
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #ifndef O_NOATIME
+ #define O_NOATIME 0
+ #endif
+ #ifndef O_NOFOLLOW
+ #define O_NOFOLLOW 0
+ #endif
+ static int const constants[] =
+ {
+ O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
+ O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
+ };
+ ]],
+ [[
+ int status = !constants;
+ {
+ static char const sym[] = "conftest.sym";
+ if (symlink (".", sym) != 0
+ || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
+ status |= 32;
+ }
+ {
+ static char const file[] = "confdefs.h";
+ int fd = open (file, O_RDONLY | O_NOATIME);
+ char c;
+ struct stat st0, st1;
+ if (fd < 0
+ || fstat (fd, &st0) != 0
+ || sleep (1) != 0
+ || read (fd, &c, 1) != 1
+ || close (fd) != 0
+ || stat (file, &st1) != 0
+ || st0.st_atime != st1.st_atime)
+ status |= 64;
+ }
+ return status;]])],
+ [gl_cv_header_working_fcntl_h=yes],
+ [case $? in #(
+ 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
+ 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
+ 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
+ *) gl_cv_header_working_fcntl_h='no';;
+ esac],
+ [gl_cv_header_working_fcntl_h=cross-compiling])])
+
+ case $gl_cv_header_working_fcntl_h in #(
+ *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
+ *) ac_val=1;;
+ esac
+ AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
+ [Define to 1 if O_NOATIME works.])
+
+ case $gl_cv_header_working_fcntl_h in #(
+ *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
+ *) ac_val=1;;
+ esac
+ AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
+ [Define to 1 if O_NOFOLLOW works.])
+
+ gl_CHECK_NEXT_HEADERS([fcntl.h])
+ FCNTL_H='fcntl.h'
+ AC_SUBST([FCNTL_H])
+])
+
+AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_FCNTL_H_DEFAULTS],
+[
+ GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
+])
diff --git a/gnulib/m4/gnulib-common.m4 b/gnulib/m4/gnulib-common.m4
index 53980108..9336d726 100644
--- a/gnulib/m4/gnulib-common.m4
+++ b/gnulib/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 2
+# gnulib-common.m4 serial 3
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -20,3 +20,46 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [
[AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
MKDIR_P='$(mkdir_p)'
AC_SUBST([MKDIR_P])])])
+
+# AC_C_RESTRICT
+# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
+# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
+# works.
+# This definition can be removed once autoconf >= 2.62 can be assumed.
+AC_DEFUN([AC_C_RESTRICT],
+[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
+ [ac_cv_c_restrict=no
+ # The order here caters to the fact that C++ does not require restrict.
+ for ac_kw in __restrict __restrict__ _Restrict restrict; do
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[typedef int * int_ptr;
+ int foo (int_ptr $ac_kw ip) {
+ return ip[0];
+ }]],
+ [[int s[1];
+ int * $ac_kw t = s;
+ t[0] = 0;
+ return foo(t)]])],
+ [ac_cv_c_restrict=$ac_kw])
+ test "$ac_cv_c_restrict" != no && break
+ done
+ ])
+ AH_VERBATIM([restrict],
+[/* Define to the equivalent of the C99 'restrict' keyword, or to
+ nothing if this is not supported. Do not define if restrict is
+ supported directly. */
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict, even
+ though the corresponding Sun C compiler does, which causes
+ "#define restrict _Restrict" in the previous line. Perhaps some future
+ version of Sun C++ will work with _Restrict; if so, it'll probably
+ define __RESTRICT, just as Sun C does. */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+#endif])
+ case $ac_cv_c_restrict in
+ restrict) ;;
+ no) AC_DEFINE([restrict], []) ;;
+ *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
+ esac
+])
diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4
index fcff3034..2d383f4f 100644
--- a/gnulib/m4/gnulib-comp.m4
+++ b/gnulib/m4/gnulib-comp.m4
@@ -52,14 +52,27 @@ AC_DEFUN([gl_INIT],
gl_FUNC_ATEXIT
AC_FUNC_CANONICALIZE_FILE_NAME
gl_MODULE_INDICATOR([canonicalize])
- gl_CYCLE_CHECK
+ gl_CANONICALIZE_LGPL
+ gl_FUNC_CHDIR_LONG
+ gl_FUNC_CHOWN
+ gl_UNISTD_MODULE_INDICATOR([chown])
gl_CHECK_TYPE_STRUCT_DIRENT_D_INO
gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
gl_FUNC_DIRFD
gl_DIRNAME
gl_DOUBLE_SLASH_ROOT
+ gl_FUNC_DUP2
+ gl_UNISTD_MODULE_INDICATOR([dup2])
gl_ERROR
+ m4_ifdef([AM_XGETTEXT_OPTION],
+ [AM_XGETTEXT_OPTION([--flag=error:3:c-format])
+ AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
gl_EXITFAIL
+ gl_FUNC_FCHDIR
+ gl_UNISTD_MODULE_INDICATOR([fchdir])
+ gl_FCNTL_H
+ gl_FCNTL_SAFER
+ gl_MODULE_INDICATOR([fcntl-safer])
gl_FILE_NAME_CONCAT
gl_FLOAT_H
# No macro. You should also use one of fnmatch-posix or fnmatch-gnu.
@@ -73,25 +86,36 @@ AC_DEFUN([gl_INIT],
AC_SUBST([LTLIBINTL])
gl_FUNC_GETTIMEOFDAY
gl_GLOB
+ gl_HASH
gl_INLINE
+ gl_FUNC_LCHOWN
+ gl_UNISTD_MODULE_INDICATOR([lchown])
gl_LOCALCHARSET
gl_LOCK
+ gl_FUNC_LSTAT
AC_FUNC_MALLOC
+ AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.])
gl_FUNC_MALLOC_POSIX
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
gl_MALLOCA
gl_FUNC_MEMCMP
gl_FUNC_MEMPCPY
gl_STRING_MODULE_INDICATOR([mempcpy])
+ gl_FUNC_MEMRCHR
+ gl_STRING_MODULE_INDICATOR([memrchr])
gl_MINMAX
gt_FUNC_MKDTEMP
gl_STDLIB_MODULE_INDICATOR([mkdtemp])
gl_FUNC_MKSTEMP
gl_STDLIB_MODULE_INDICATOR([mkstemp])
+ gl_FUNC_OPENAT
+ gl_PATHMAX
gl_FUNC_READLINK
gl_UNISTD_MODULE_INDICATOR([readlink])
gl_REGEX
gl_FUNC_RENAME
+ gl_SAME
+ gl_SAVE_CWD
gl_FUNC_SETENV
gl_FUNC_UNSETENV
gl_SIZE_MAX
@@ -110,7 +134,9 @@ AC_DEFUN([gl_INIT],
gl_FUNC_STRDUP
gl_STRING_MODULE_INDICATOR([strdup])
gl_FUNC_STRERROR
+ gl_STRING_MODULE_INDICATOR([strerror])
gl_HEADER_STRING_H
+ gl_HEADER_STRINGS_H
gl_FUNC_STRNDUP
gl_STRING_MODULE_INDICATOR([strndup])
gl_FUNC_STRNLEN
@@ -130,9 +156,13 @@ AC_DEFUN([gl_INIT],
gl_SYSEXITS
gl_FUNC_GEN_TEMPNAME
gl_UNISTD_H
+ gl_UNISTD_SAFER
gl_FUNC_VASNPRINTF
gl_FUNC_VASPRINTF
gl_STDIO_MODULE_INDICATOR([vasprintf])
+ m4_ifdef([AM_XGETTEXT_OPTION],
+ [AM_XGETTEXT_OPTION([--flag=asprintf:2:c-format])
+ AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
gl_FUNC_VSNPRINTF
gl_STDIO_MODULE_INDICATOR([vsnprintf])
gl_WCHAR_H
@@ -142,6 +172,8 @@ AC_DEFUN([gl_INIT],
gl_XSIZE
gl_XSTRNDUP
gl_XVASPRINTF
+ m4_ifdef([AM_XGETTEXT_OPTION],
+ [AM_XGETTEXT_OPTION([--flag=xasprintf:1:c-format])])
LIBGNU_LIBDEPS="$gl_libdeps"
AC_SUBST([LIBGNU_LIBDEPS])
LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
@@ -167,18 +199,31 @@ AC_DEFUN([gl_INIT],
# Like AC_LIBOBJ, except that the module name goes
# into gl_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([gl_LIBOBJ],
- [gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"])
+AC_DEFUN([gl_LIBOBJ], [
+ AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
+ gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
+])
# Like AC_REPLACE_FUNCS, except that the module name goes
# into gl_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([gl_REPLACE_FUNCS],
- [AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])])
+AC_DEFUN([gl_REPLACE_FUNCS], [
+ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
+ AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
+])
-# Like AC_LIBSOURCES, except that it does nothing.
-# We rely on EXTRA_lib..._SOURCES instead.
-AC_DEFUN([gl_LIBSOURCES],
- [])
+# Like AC_LIBSOURCES, except the directory where the source file is
+# expected is derived from the gnulib-tool parametrization,
+# and alloca is special cased (for the alloca-opt module).
+# We could also entirely rely on EXTRA_lib..._SOURCES.
+AC_DEFUN([gl_LIBSOURCES], [
+ m4_foreach([_gl_NAME], [$1], [
+ m4_if(_gl_NAME, [alloca.c], [], [
+ m4_syscmd([test -r gnulib/lib/]_gl_NAME[ || test ! -d gnulib/lib])dnl
+ m4_if(m4_sysval, [0], [],
+ [AC_FATAL([missing gnulib/lib/]_gl_NAME)])
+ ])
+ ])
+])
# This macro records the list of files which have been installed by
# gnulib-tool and may be removed by future gnulib-tool invocations.
@@ -186,7 +231,7 @@ AC_DEFUN([gl_FILE_LIST], [
build-aux/config.rpath
build-aux/link-warning.h
lib/alloca.c
- lib/alloca_.h
+ lib/alloca.in.h
lib/areadlink-with-size.c
lib/areadlink.h
lib/argp-ba.c
@@ -204,54 +249,90 @@ AC_DEFUN([gl_FILE_LIST], [
lib/argp.h
lib/asnprintf.c
lib/asprintf.c
+ lib/at-func.c
lib/atexit.c
lib/basename.c
+ lib/canonicalize-lgpl.c
lib/canonicalize.c
lib/canonicalize.h
+ lib/chdir-long.c
+ lib/chdir-long.h
+ lib/chown.c
lib/config.charset
- lib/cycle-check.c
- lib/cycle-check.h
- lib/dev-ino.h
+ lib/creat-safer.c
+ lib/dirent.in.h
lib/dirfd.c
lib/dirfd.h
lib/dirname.c
lib/dirname.h
+ lib/dup-safer.c
+ lib/dup2.c
lib/error.c
lib/error.h
lib/exitfail.c
lib/exitfail.h
+ lib/fchdir.c
+ lib/fchmodat.c
+ lib/fchown-stub.c
+ lib/fchownat.c
+ lib/fcntl--.h
+ lib/fcntl-safer.h
+ lib/fcntl.in.h
+ lib/fd-safer.c
+ lib/file-set.c
+ lib/file-set.h
lib/filenamecat.c
lib/filenamecat.h
lib/float+.h
- lib/float_.h
+ lib/float.in.h
lib/fnmatch.c
- lib/fnmatch_.h
+ lib/fnmatch.in.h
lib/fnmatch_loop.c
+ lib/fstatat.c
lib/getcwd.c
lib/getlogin_r.c
lib/getopt.c
+ lib/getopt.in.h
lib/getopt1.c
- lib/getopt_.h
lib/getopt_int.h
lib/gettext.h
lib/gettimeofday.c
lib/glob-libc.h
lib/glob.c
- lib/glob_.h
+ lib/glob.in.h
+ lib/hash-pjw.c
+ lib/hash-pjw.h
+ lib/hash-triple.c
+ lib/hash-triple.h
+ lib/hash.c
+ lib/hash.h
+ lib/intprops.h
+ lib/lchown.c
lib/localcharset.c
lib/localcharset.h
lib/lock.c
lib/lock.h
+ lib/lstat.c
+ lib/lstat.h
lib/malloc.c
lib/malloca.c
lib/malloca.h
lib/malloca.valgrind
lib/memcmp.c
lib/mempcpy.c
+ lib/memrchr.c
lib/minmax.h
+ lib/mkdirat.c
lib/mkdtemp.c
lib/mkstemp.c
+ lib/open-safer.c
+ lib/openat-die.c
+ lib/openat-priv.h
+ lib/openat-proc.c
+ lib/openat.c
+ lib/openat.h
lib/pathmax.h
+ lib/pipe-safer.c
lib/printf-args.c
lib/printf-args.h
lib/printf-parse.c
@@ -267,41 +348,48 @@ AC_DEFUN([gl_FILE_LIST], [
lib/regexec.c
lib/rename.c
lib/same-inode.h
+ lib/same.c
+ lib/same.h
+ lib/save-cwd.c
+ lib/save-cwd.h
lib/setenv.c
lib/setenv.h
lib/size_max.h
lib/sleep.c
- lib/stdbool_.h
- lib/stdint_.h
- lib/stdio_.h
- lib/stdlib_.h
+ lib/stdbool.in.h
+ lib/stdint.in.h
+ lib/stdio.in.h
+ lib/stdlib.in.h
lib/strcasecmp.c
lib/strchrnul.c
lib/strcspn.c
lib/strdup.c
lib/strerror.c
- lib/string_.h
+ lib/string.in.h
+ lib/strings.in.h
lib/stripslash.c
lib/strncasecmp.c
lib/strndup.c
lib/strnlen.c
lib/strpbrk.c
lib/strsep.c
- lib/sys_select_.h
- lib/sys_socket_.h
- lib/sys_stat_.h
- lib/sys_time_.h
- lib/sysexits_.h
+ lib/sys_select.in.h
+ lib/sys_socket.in.h
+ lib/sys_stat.in.h
+ lib/sys_time.in.h
+ lib/sysexits.in.h
lib/tempname.c
lib/tempname.h
- lib/unistd_.h
+ lib/unistd--.h
+ lib/unistd-safer.h
+ lib/unistd.in.h
lib/unsetenv.c
lib/vasnprintf.c
lib/vasnprintf.h
lib/vasprintf.c
lib/vsnprintf.c
- lib/wchar_.h
- lib/wctype_.h
+ lib/wchar.in.h
+ lib/wctype.in.h
lib/xalloc-die.c
lib/xalloc.h
lib/xasprintf.c
@@ -317,20 +405,26 @@ AC_DEFUN([gl_FILE_LIST], [
m4/alloca.m4
m4/argp.m4
m4/atexit.m4
+ m4/canonicalize-lgpl.m4
m4/canonicalize.m4
+ m4/chdir-long.m4
+ m4/chown.m4
m4/codeset.m4
- m4/cycle-check.m4
m4/d-ino.m4
m4/d-type.m4
m4/dirfd.m4
m4/dirname.m4
m4/dos.m4
m4/double-slash-root.m4
+ m4/dup2.m4
m4/eealloc.m4
m4/eoverflow.m4
m4/error.m4
m4/exitfail.m4
m4/extensions.m4
+ m4/fchdir.m4
+ m4/fcntl-safer.m4
+ m4/fcntl_h.m4
m4/filenamecat.m4
m4/float_h.m4
m4/fnmatch.m4
@@ -343,28 +437,36 @@ AC_DEFUN([gl_FILE_LIST], [
m4/glibc21.m4
m4/glob.m4
m4/gnulib-common.m4
+ m4/hash.m4
m4/include_next.m4
m4/inline.m4
m4/intmax_t.m4
m4/inttypes_h.m4
+ m4/lchown.m4
m4/lib-ld.m4
m4/lib-link.m4
m4/lib-prefix.m4
m4/localcharset.m4
m4/lock.m4
m4/longlong.m4
+ m4/lstat.m4
m4/malloc.m4
m4/malloca.m4
m4/mbstate_t.m4
m4/memcmp.m4
m4/mempcpy.m4
+ m4/memrchr.m4
m4/minmax.m4
m4/mkdtemp.m4
m4/mkstemp.m4
m4/onceonly_2_57.m4
+ m4/openat.m4
+ m4/pathmax.m4
m4/readlink.m4
m4/regex.m4
m4/rename.m4
+ m4/same.m4
+ m4/save-cwd.m4
m4/setenv.m4
m4/size_max.m4
m4/sleep.m4
@@ -382,6 +484,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/strdup.m4
m4/strerror.m4
m4/string_h.m4
+ m4/strings_h.m4
m4/strndup.m4
m4/strnlen.m4
m4/strpbrk.m4
@@ -392,7 +495,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/sys_time_h.m4
m4/sysexits.m4
m4/tempname.m4
- m4/ulonglong.m4
+ m4/unistd-safer.m4
m4/unistd_h.m4
m4/vasnprintf.m4
m4/vasprintf.m4
diff --git a/gnulib/m4/hash.m4 b/gnulib/m4/hash.m4
new file mode 100644
index 00000000..1b1873c3
--- /dev/null
+++ b/gnulib/m4/hash.m4
@@ -0,0 +1,13 @@
+# hash.m4 serial 6
+dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_HASH],
+[
+ AC_LIBOBJ([hash])
+
+ dnl Prerequisites of lib/hash.c.
+ AC_REQUIRE([AM_STDBOOL_H])
+])
diff --git a/gnulib/m4/intmax_t.m4 b/gnulib/m4/intmax_t.m4
index 17c7b0ae..50ae35d2 100644
--- a/gnulib/m4/intmax_t.m4
+++ b/gnulib/m4/intmax_t.m4
@@ -1,5 +1,5 @@
-# intmax_t.m4 serial 5
-dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
+# intmax_t.m4 serial 6
+dnl Copyright (C) 1997-2004, 2006-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -18,8 +18,8 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T],
AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
AC_REQUIRE([gl_AC_HEADER_STDINT_H])
if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
- AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
- test $ac_cv_type_long_long = yes \
+ AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+ test $ac_cv_type_long_long_int = yes \
&& ac_type='long long' \
|| ac_type='long'
AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
@@ -51,8 +51,8 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
AC_DEFINE(HAVE_INTMAX_T, 1,
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
else
- AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
- test $ac_cv_type_long_long = yes \
+ AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+ test $ac_cv_type_long_long_int = yes \
&& ac_type='long long' \
|| ac_type='long'
AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
diff --git a/gnulib/m4/lchown.m4 b/gnulib/m4/lchown.m4
new file mode 100644
index 00000000..b719ed07
--- /dev/null
+++ b/gnulib/m4/lchown.m4
@@ -0,0 +1,22 @@
+#serial 12
+# Determine whether we need the lchown wrapper.
+
+dnl Copyright (C) 1998, 2001, 2003, 2004, 2005, 2006, 2007 Free
+dnl Software Foundation, Inc.
+
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering.
+dnl Provide lchown on systems that lack it.
+
+AC_DEFUN([gl_FUNC_LCHOWN],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_CHOWN])
+ AC_REPLACE_FUNCS(lchown)
+ if test $ac_cv_func_lchown = no; then
+ REPLACE_LCHOWN=1
+ fi
+])
diff --git a/gnulib/m4/lib-link.m4 b/gnulib/m4/lib-link.m4
index f157d983..e3d26fc4 100644
--- a/gnulib/m4/lib-link.m4
+++ b/gnulib/m4/lib-link.m4
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 13 (gettext-0.16.2)
+# lib-link.m4 serial 13 (gettext-0.17)
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gnulib/m4/lock.m4 b/gnulib/m4/lock.m4
index 4cc585ea..91119335 100644
--- a/gnulib/m4/lock.m4
+++ b/gnulib/m4/lock.m4
@@ -1,4 +1,4 @@
-# lock.m4 serial 7 (gettext-0.16.2)
+# lock.m4 serial 7 (gettext-0.17)
dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gnulib/m4/longlong.m4 b/gnulib/m4/longlong.m4
index 1f9e862e..15bf9dac 100644
--- a/gnulib/m4/longlong.m4
+++ b/gnulib/m4/longlong.m4
@@ -1,5 +1,5 @@
-# longlong.m4 serial 10
-dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
+# longlong.m4 serial 13
+dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert.
# Define HAVE_LONG_LONG_INT if 'long long int' works.
-# This fixes a bug in Autoconf 2.60, but can be removed once we
-# assume 2.61 everywhere.
+# This fixes a bug in Autoconf 2.61, but can be removed once we
+# assume 2.62 everywhere.
# Note: If the type 'long long int' exists but is only 32 bits large
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -18,20 +18,11 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
[AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[long long int ll = 9223372036854775807ll;
- long long int nll = -9223372036854775807LL;
- typedef int a[((-9223372036854775807LL < 0
- && 0 < 9223372036854775807ll)
- ? 1 : -1)];
- int i = 63;]],
- [[long long int llmax = 9223372036854775807ll;
- return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
- | (llmax / ll) | (llmax % ll));]])],
+ [_AC_TYPE_LONG_LONG_SNIPPET],
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
dnl If cross compiling, assume the bug isn't important, since
dnl nobody cross compiles for this platform as far as we know.
- AC_RUN_IFELSE(
+ AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[@%:@include <limits.h>
@%:@ifndef LLONG_MAX
@@ -60,13 +51,56 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
fi
])
-# This macro is obsolescent and should go away soon.
-AC_DEFUN([gl_AC_TYPE_LONG_LONG],
+# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
+# This fixes a bug in Autoconf 2.61, but can be removed once we
+# assume 2.62 everywhere.
+
+# Note: If the type 'unsigned long long int' exists but is only 32 bits
+# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
+# will not be defined. In this case you can treat 'unsigned long long int'
+# like 'unsigned long int'.
+
+AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
[
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- ac_cv_type_long_long=$ac_cv_type_long_long_int
- if test $ac_cv_type_long_long = yes; then
- AC_DEFINE(HAVE_LONG_LONG, 1,
- [Define if you have the 'long long' type.])
+ AC_CACHE_CHECK([for unsigned long long int],
+ [ac_cv_type_unsigned_long_long_int],
+ [AC_LINK_IFELSE(
+ [_AC_TYPE_LONG_LONG_SNIPPET],
+ [ac_cv_type_unsigned_long_long_int=yes],
+ [ac_cv_type_unsigned_long_long_int=no])])
+ if test $ac_cv_type_unsigned_long_long_int = yes; then
+ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
+ [Define to 1 if the system has the type `unsigned long long int'.])
fi
])
+
+# Expands to a C program that can be used to test for simultaneous support
+# of 'long long' and 'unsigned long long'. We don't want to say that
+# 'long long' is available if 'unsigned long long' is not, or vice versa,
+# because too many programs rely on the symmetry between signed and unsigned
+# integer types (excluding 'bool').
+AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
+[
+ AC_LANG_PROGRAM(
+ [[/* For now, do not test the preprocessor; as of 2007 there are too many
+ implementations with broken preprocessors. Perhaps this can
+ be revisited in 2012. In the meantime, code should not expect
+ #if to work with literals wider than 32 bits. */
+ /* Test literals. */
+ long long int ll = 9223372036854775807ll;
+ long long int nll = -9223372036854775807LL;
+ unsigned long long int ull = 18446744073709551615ULL;
+ /* Test constant expressions. */
+ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+ ? 1 : -1)];
+ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+ ? 1 : -1)];
+ int i = 63;]],
+ [[/* Test availability of runtime routines for shift and division. */
+ long long int llmax = 9223372036854775807ll;
+ unsigned long long int ullmax = 18446744073709551615ull;
+ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+ | (llmax / ll) | (llmax % ll)
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+ | (ullmax / ull) | (ullmax % ull));]])
+])
diff --git a/gnulib/m4/lstat.m4 b/gnulib/m4/lstat.m4
new file mode 100644
index 00000000..b9777a6a
--- /dev/null
+++ b/gnulib/m4/lstat.m4
@@ -0,0 +1,17 @@
+#serial 16
+
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering.
+
+AC_DEFUN([gl_FUNC_LSTAT],
+[
+ AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
+ dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ(lstat).
+ :
+])
diff --git a/gnulib/m4/mempcpy.m4 b/gnulib/m4/mempcpy.m4
index 13293b55..d1a12ebf 100644
--- a/gnulib/m4/mempcpy.m4
+++ b/gnulib/m4/mempcpy.m4
@@ -1,4 +1,4 @@
-# mempcpy.m4 serial 8
+# mempcpy.m4 serial 9
dnl Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_MEMPCPY],
dnl Persuade glibc <string.h> to declare mempcpy().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
- dnl The mempcpy() declaration in lib/string_.h uses 'restrict'.
+ dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'.
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
diff --git a/gnulib/m4/memrchr.m4 b/gnulib/m4/memrchr.m4
new file mode 100644
index 00000000..8070d5fe
--- /dev/null
+++ b/gnulib/m4/memrchr.m4
@@ -0,0 +1,25 @@
+# memrchr.m4 serial 8
+dnl Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_MEMRCHR],
+[
+ dnl Persuade glibc <string.h> to declare memrchr().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_CHECK_DECLS_ONCE([memrchr])
+ if test $ac_cv_have_decl_memrchr = no; then
+ HAVE_DECL_MEMRCHR=0
+ fi
+
+ AC_REPLACE_FUNCS(memrchr)
+ if test $ac_cv_func_memrchr = no; then
+ gl_PREREQ_MEMRCHR
+ fi
+])
+
+# Prerequisites of lib/memrchr.c.
+AC_DEFUN([gl_PREREQ_MEMRCHR], [:])
diff --git a/gnulib/m4/openat.m4 b/gnulib/m4/openat.m4
new file mode 100644
index 00000000..43f46d08
--- /dev/null
+++ b/gnulib/m4/openat.m4
@@ -0,0 +1,90 @@
+#serial 15
+# See if we need to use our replacement for Solaris' openat et al functions.
+
+dnl Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_OPENAT],
+[
+ AC_LIBOBJ([openat-proc])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([lchmod])
+ AC_CHECK_FUNCS_ONCE([fdopendir])
+ AC_REPLACE_FUNCS([fchmodat mkdirat openat])
+ case $ac_cv_func_openat+$ac_cv_func_lstat_dereferences_slashed_symlink in
+ yes+yes) ;;
+ yes+*) AC_LIBOBJ([fstatat]);;
+ *)
+ AC_DEFINE([__OPENAT_PREFIX], [[rpl_]],
+ [Define to rpl_ if the openat replacement function should be used.])
+ gl_PREREQ_OPENAT;;
+ esac
+ gl_FUNC_FCHOWNAT
+])
+
+# gl_FUNC_FCHOWNAT_DEREF_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
+AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG],
+[
+ AC_CACHE_CHECK([whether fchownat works with AT_SYMLINK_NOFOLLOW],
+ gl_cv_func_fchownat_nofollow_works,
+ [
+ gl_dangle=conftest.dangle
+ # Remove any remnants of a previous test.
+ rm -f $gl_dangle
+ # Arrange for deletion of the temporary file this test creates.
+ ac_clean_files="$ac_clean_files $gl_dangle"
+ ln -s conftest.no-such $gl_dangle
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [[
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+int
+main ()
+{
+ return (fchownat (AT_FDCWD, "$gl_dangle", -1, getgid (),
+ AT_SYMLINK_NOFOLLOW) != 0
+ && errno == ENOENT);
+}
+ ]])],
+ [gl_cv_func_fchownat_nofollow_works=yes],
+ [gl_cv_func_fchownat_nofollow_works=no],
+ [gl_cv_func_fchownat_nofollow_works=no],
+ )
+ ])
+ AS_IF([test $gl_cv_func_fchownat_nofollow_works = no], [$1], [$2])
+])
+
+# If we have the fchownat function, and it has the bug (in glibc-2.4)
+# that it dereferences symlinks even with AT_SYMLINK_NOFOLLOW, then
+# use the replacement function.
+# Also use the replacement function if fchownat is simply not available.
+AC_DEFUN([gl_FUNC_FCHOWNAT],
+[
+ # Assume we'll use the replacement function.
+ # The only case in which we won't is when we have fchownat, and it works.
+ use_replacement_fchownat=yes
+
+ AC_CHECK_FUNC([fchownat], [have_fchownat=yes], [have_fchownat=no])
+ if test $have_fchownat = yes; then
+ gl_FUNC_FCHOWNAT_DEREF_BUG([], [use_replacement_fchownat=no])
+ fi
+
+ if test $use_replacement_fchownat = yes; then
+ AC_LIBOBJ(fchownat)
+ AC_DEFINE(fchownat, rpl_fchownat,
+ [Define to rpl_fchownat if the replacement function should be used.])
+ fi
+])
+
+AC_DEFUN([gl_PREREQ_OPENAT],
+[
+ :
+])
diff --git a/gnulib/m4/pathmax.m4 b/gnulib/m4/pathmax.m4
new file mode 100644
index 00000000..64bf26ff
--- /dev/null
+++ b/gnulib/m4/pathmax.m4
@@ -0,0 +1,11 @@
+# pathmax.m4 serial 6
+dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_PATHMAX],
+[
+ dnl Prerequisites of lib/pathmax.h.
+ AC_CHECK_HEADERS_ONCE(sys/param.h)
+])
diff --git a/gnulib/m4/same.m4 b/gnulib/m4/same.m4
new file mode 100644
index 00000000..709c8f1c
--- /dev/null
+++ b/gnulib/m4/same.m4
@@ -0,0 +1,14 @@
+#serial 8
+dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SAME],
+[
+ AC_LIBOBJ([same])
+
+ dnl Prerequisites of lib/same.c.
+ AC_REQUIRE([AC_SYS_LONG_FILE_NAMES])
+ AC_CHECK_FUNCS_ONCE([pathconf])
+])
diff --git a/gnulib/m4/save-cwd.m4 b/gnulib/m4/save-cwd.m4
new file mode 100644
index 00000000..7a2286bf
--- /dev/null
+++ b/gnulib/m4/save-cwd.m4
@@ -0,0 +1,12 @@
+#serial 8
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SAVE_CWD],
+[
+ AC_LIBOBJ([save-cwd])
+ dnl Prerequisites for lib/save-cwd.c.
+ AC_CHECK_FUNCS_ONCE(fchdir)
+])
diff --git a/gnulib/m4/stdint.m4 b/gnulib/m4/stdint.m4
index 03bb0932..bb6c34fe 100644
--- a/gnulib/m4/stdint.m4
+++ b/gnulib/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 28
+# stdint.m4 serial 29
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -370,7 +370,7 @@ AC_DEFUN([gl_STDINT_INCLUDES],
dnl gl_STDINT_TYPE_PROPERTIES
dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
-dnl of interest to stdint_.h.
+dnl of interest to stdint.in.h.
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
[
gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
diff --git a/gnulib/m4/stdio_h.m4 b/gnulib/m4/stdio_h.m4
index b9a69984..83d48ecc 100644
--- a/gnulib/m4/stdio_h.m4
+++ b/gnulib/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 7
+# stdio_h.m4 serial 8
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -28,6 +28,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
+ GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
+ GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
@@ -48,6 +50,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
+ REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
+ REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
@@ -69,13 +73,15 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
[#if defined __SL64 && defined __SCLE /* cygwin */
/* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
- fseeko/ftello needlessly fail. This bug was fixed at the same time
- that cygwin started exporting asnprintf (cygwin 1.7.0), so we use
- that as a link-time test for cross-compiles rather than building
- a runtime test. */
- size_t s;
- if (asnprintf (NULL, &s, ""))
- return 0;
+ fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, at the
+ same time that cygwin fixed the declaration of "long timezone" to no
+ longer be a macro, so we use that as a compile-time test for
+ cross-compiles rather than building a runtime test. */
+# define timezonevar
+# include <sys/time.h>
+# ifdef timezone
+ choke me
+# endif
#endif])],
[gl_cv_var_stdin_large_offset=yes],
[gl_cv_var_stdin_large_offset=no])])
diff --git a/gnulib/m4/stdlib_h.m4 b/gnulib/m4/stdlib_h.m4
index ea9286ef..278df744 100644
--- a/gnulib/m4/stdlib_h.m4
+++ b/gnulib/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 3
+# stdlib_h.m4 serial 4
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
+ GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
@@ -32,4 +33,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
+ REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
])
diff --git a/gnulib/m4/strerror.m4 b/gnulib/m4/strerror.m4
index bbcda305..9cb5769b 100644
--- a/gnulib/m4/strerror.m4
+++ b/gnulib/m4/strerror.m4
@@ -1,4 +1,4 @@
-# strerror.m4 serial 3
+# strerror.m4 serial 6
dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,21 +6,41 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRERROR],
[
- AC_CHECK_FUNCS_ONCE([strerror])
- if test $ac_cv_func_strerror = no; then
+ AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
+ if test $gl_cv_func_working_strerror = no; then
AC_LIBOBJ([strerror])
- gl_PREREQ_STRERROR
+ AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
+ [Define this to 1 if strerror is broken.])
fi
])
# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ).
AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
[
- AC_CHECK_FUNCS_ONCE([strerror])
- gl_PREREQ_STRERROR
+ AC_CACHE_CHECK([for working strerror function],
+ [gl_cv_func_working_strerror],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <string.h>
+ ],
+ [return !*strerror (-2);])],
+ [gl_cv_func_working_strerror=yes],
+ [gl_cv_func_working_strerror=no],
+ [dnl Assume crossbuild works if it compiles.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <string.h>
+ ],
+ [return !*strerror (-2);])],
+ [gl_cv_func_working_strerror=yes],
+ [gl_cv_func_working_strerror=no])])])
+ if test $gl_cv_func_working_strerror = no ; then
+ REPLACE_STRERROR=1
+ gl_PREREQ_STRERROR
+ fi
])
# Prerequisites of lib/strerror.c.
AC_DEFUN([gl_PREREQ_STRERROR], [
- :
+ AC_CHECK_DECLS([strerror])
])
diff --git a/gnulib/m4/string_h.m4 b/gnulib/m4/string_h.m4
index ec51e9a0..83711799 100644
--- a/gnulib/m4/string_h.m4
+++ b/gnulib/m4/string_h.m4
@@ -57,14 +57,13 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
+ GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
- HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
- HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP])
@@ -74,4 +73,6 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
+ HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
+ REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
])
diff --git a/gnulib/m4/strings_h.m4 b/gnulib/m4/strings_h.m4
new file mode 100644
index 00000000..03ac182f
--- /dev/null
+++ b/gnulib/m4/strings_h.m4
@@ -0,0 +1,33 @@
+# Configure a replacement for <string.h>.
+
+# Copyright (C) 2007 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_HEADER_STRINGS_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_HEADER_STRINGS_H_BODY])
+])
+
+AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
+[
+ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
+ gl_CHECK_NEXT_HEADERS([strings.h])
+])
+
+AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
+ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS],
+[
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
+ HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
+])
diff --git a/gnulib/m4/strsep.m4 b/gnulib/m4/strsep.m4
index acbd8d1c..1231dcb1 100644
--- a/gnulib/m4/strsep.m4
+++ b/gnulib/m4/strsep.m4
@@ -1,4 +1,4 @@
-# strsep.m4 serial 7
+# strsep.m4 serial 8
dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_STRSEP],
dnl Persuade glibc <string.h> to declare strsep().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
- dnl The strsep() declaration in lib/string_.h uses 'restrict'.
+ dnl The strsep() declaration in lib/string.in.h uses 'restrict'.
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
diff --git a/gnulib/m4/ulonglong.m4 b/gnulib/m4/ulonglong.m4
deleted file mode 100644
index 9fae98e3..00000000
--- a/gnulib/m4/ulonglong.m4
+++ /dev/null
@@ -1,48 +0,0 @@
-# ulonglong.m4 serial 6
-dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Paul Eggert.
-
-# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
-# This fixes a bug in Autoconf 2.60, but can be removed once we
-# assume 2.61 everywhere.
-
-# Note: If the type 'unsigned long long int' exists but is only 32 bits
-# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
-# will not be defined. In this case you can treat 'unsigned long long int'
-# like 'unsigned long int'.
-
-AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
-[
- AC_CACHE_CHECK([for unsigned long long int],
- [ac_cv_type_unsigned_long_long_int],
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[unsigned long long int ull = 18446744073709551615ULL;
- typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
- ? 1 : -1)];
- int i = 63;]],
- [[unsigned long long int ullmax = 18446744073709551615ull;
- return (ull << 63 | ull >> 63 | ull << i | ull >> i
- | ullmax / ull | ullmax % ull);]])],
- [ac_cv_type_unsigned_long_long_int=yes],
- [ac_cv_type_unsigned_long_long_int=no])])
- if test $ac_cv_type_unsigned_long_long_int = yes; then
- AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
- [Define to 1 if the system has the type `unsigned long long int'.])
- fi
-])
-
-# This macro is obsolescent and should go away soon.
-AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
-[
- AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
- ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
- if test $ac_cv_type_unsigned_long_long = yes; then
- AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
- [Define if you have the 'unsigned long long' type.])
- fi
-])
diff --git a/gnulib/m4/unistd-safer.m4 b/gnulib/m4/unistd-safer.m4
new file mode 100644
index 00000000..09adf931
--- /dev/null
+++ b/gnulib/m4/unistd-safer.m4
@@ -0,0 +1,13 @@
+#serial 8
+dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_UNISTD_SAFER],
+[
+ AC_CHECK_FUNCS_ONCE([pipe])
+ AC_LIBOBJ([dup-safer])
+ AC_LIBOBJ([fd-safer])
+ AC_LIBOBJ([pipe-safer])
+])
diff --git a/gnulib/m4/unistd_h.m4 b/gnulib/m4/unistd_h.m4
index b12f84e8..91c02e7c 100644
--- a/gnulib/m4/unistd_h.m4
+++ b/gnulib/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 9
+# unistd_h.m4 serial 10
dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -38,6 +38,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
+ GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
@@ -45,9 +46,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
+ HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
+ HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
+ HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
diff --git a/gnulib/m4/vasnprintf.m4 b/gnulib/m4/vasnprintf.m4
index ef2de787..6449a9c5 100644
--- a/gnulib/m4/vasnprintf.m4
+++ b/gnulib/m4/vasnprintf.m4
@@ -1,4 +1,4 @@
-# vasnprintf.m4 serial 20
+# vasnprintf.m4 serial 23
dnl Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -45,7 +45,10 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
AC_REQUIRE([AC_TYPE_SIZE_T])
- AC_CHECK_TYPES(ptrdiff_t)
+ AC_CHECK_TYPE([ptrdiff_t], ,
+ [AC_DEFINE([ptrdiff_t], [long],
+ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
+ ])
AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
])
@@ -178,6 +181,49 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
esac
])
+# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
+[
+ AC_REQUIRE([gl_PRINTF_PRECISION])
+ case "$gl_cv_func_printf_precision" in
+ *yes)
+ ;;
+ *)
+ AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1,
+ [Define if the vasnprintf implementation needs special code for
+ supporting large precisions without arbitrary bounds.])
+ AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
+ [Define if the vasnprintf implementation needs special code for
+ 'double' arguments.])
+ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
+ [Define if the vasnprintf implementation needs special code for
+ 'long double' arguments.])
+ ;;
+ esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
+# conditions.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
+[
+ AC_REQUIRE([gl_PRINTF_ENOMEM])
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ ;;
+ *)
+ AC_DEFINE([NEED_PRINTF_ENOMEM], 1,
+ [Define if the vasnprintf implementation needs special code for
+ surviving out-of-memory conditions.])
+ AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
+ [Define if the vasnprintf implementation needs special code for
+ 'double' arguments.])
+ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
+ [Define if the vasnprintf implementation needs special code for
+ 'long double' arguments.])
+ ;;
+ esac
+])
+
# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
[
@@ -189,6 +235,8 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_ZERO
+ gl_PREREQ_VASNPRINTF_PRECISION
+ gl_PREREQ_VASNPRINTF_ENOMEM
])
# Prerequisites of lib/asnprintf.c.
diff --git a/gnulib/m4/wint_t.m4 b/gnulib/m4/wint_t.m4
index 2cac1a71..af5ed936 100644
--- a/gnulib/m4/wint_t.m4
+++ b/gnulib/m4/wint_t.m4
@@ -1,4 +1,4 @@
-# wint_t.m4 serial 2 (gettext-0.16.2)
+# wint_t.m4 serial 2 (gettext-0.17)
dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,